package com.ldj.struts.action;

import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

import com.ldj.common.MenuBuilder;
import com.ldj.common.SystemConfig;
import com.ldj.common.SystemSession;
import com.ldj.common.Upload;
import com.ldj.hibernate.ApplyCase;
import com.ldj.hibernate.ApplyEndcase;
import com.ldj.hibernate.CaseChangeInsp;
import com.ldj.hibernate.CaseInfo;
import com.ldj.hibernate.CaseInfoDAO;
import com.ldj.hibernate.CaseNotApply;
import com.ldj.hibernate.DelayInspect;
import com.ldj.hibernate.DiscussRecord;
import com.ldj.hibernate.DisposalConsiderations;
import com.ldj.hibernate.DisposalDecision;
import com.ldj.hibernate.DisposalNotice;
import com.ldj.hibernate.DisposalRectification;
import com.ldj.hibernate.DisposalTrack;
import com.ldj.hibernate.EmployerInfo;
import com.ldj.hibernate.EmployerInfoDAO;
import com.ldj.hibernate.EnforceDo;
import com.ldj.hibernate.EvidDeci;
import com.ldj.hibernate.EvidRigiNoti;
import com.ldj.hibernate.EvidenceInfo;
import com.ldj.hibernate.GivePowerBook;
import com.ldj.hibernate.PersionFile;
import com.ldj.hibernate.PersionFileDAO;
import com.ldj.hibernate.QuerNotiInfo;
import com.ldj.hibernate.ReceiptInfo;
import com.ldj.hibernate.RefuseCase;
import com.ldj.hibernate.SuperviseOrganDAO;
import com.ldj.hibernate.SysLogInfo;
import com.ldj.hibernate.SysLogInfoDAO;
import com.ldj.hibernate.UserManagerScope;
import com.ldj.struts.form.ApplyCaseForm;
import com.ldj.struts.form.ApplyEndcaseForm;
import com.ldj.struts.form.CaseChangeInspForm;
import com.ldj.struts.form.CaseInfoForm;
import com.ldj.struts.form.CaseNotApplyForm;
import com.ldj.struts.form.DelayInspectForm;
import com.ldj.struts.form.DiscussRecordForm;
import com.ldj.struts.form.DisposalConsiderationsForm;
import com.ldj.struts.form.DisposalDecisionForm;
import com.ldj.struts.form.DisposalNoticeForm;
import com.ldj.struts.form.DisposalRectificationForm;
import com.ldj.struts.form.DisposalTrackForm;
import com.ldj.struts.form.EnforceDoForm;
import com.ldj.struts.form.EvidDeciForm;
import com.ldj.struts.form.EvidRigiNotiForm;
import com.ldj.struts.form.EvidenceInfoForm;
import com.ldj.struts.form.GivePowerBookForm;
import com.ldj.struts.form.QuerNotiInfoForm;
import com.ldj.struts.form.ReceiptInfoForm;
import com.ldj.struts.form.RefuseCaseForm;

public class CaseInfoAction extends DispatchAction {
	/**
	 * 案卷管理
	 */
	public ActionForward historyList(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		String caseInfoCode = request.getParameter("caseInfoCode");
		String empInfoName = request.getParameter("empInfoName");
		dao.getSession().flush();
		dao.getSession().clear();
		List list = dao.findEndCaseAllPage(caseInfoCode, empInfoName);
		request.setAttribute("list", list);
		return mapping.findForward("historyList");
	}

	public ActionForward tree(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		String value = "";
		PersionFileDAO dao = new PersionFileDAO(request,response);
		List<UserManagerScope> infoList = dao.findBySuperviseOrganId(SystemSession.getSupUserId(request));
		if(infoList != null && infoList.size()>0){
			UserManagerScope info1 =infoList.get(0);
			value = info1.getUserManagerScopeOrganId();
		}
		MenuBuilder bu = new MenuBuilder();
		request.setAttribute("tree", bu.getPowerSuperviseOrganTree(request, response, "监察机构", "", "CaseInfo.do?method=staticList&code=$code", value));		
		return mapping.findForward("tree");
	}
	
	public ActionForward staticList(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		String code = request.getParameter("code");
		String caseInfoCode = request.getParameter("caseInfoCode");
		String empInfoName = request.getParameter("empInfoName");
		dao.getSession().flush();
		dao.getSession().clear();
		List list = dao.findStaticCaseAllPage(caseInfoCode, empInfoName, code);
		request.setAttribute("list", list);
		return mapping.findForward("staticList");
	}
	
	public ActionForward historyDetail(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		CaseInfo info = dao.findById(request.getParameter("cid"));
		dao.getSession().flush();
		dao.getSession().clear();
		request.setAttribute("cInfo", info);
		//立案审批表
		request.setAttribute("applyCase", dao.findApplyCaseByCaseId(request.getParameter("cid")));
        //不予以受理决定书
		request.setAttribute("refuseCase", dao.findRefuseCaseFromCaseId(request.getParameter("cid")));
		  //授权委托书
		request.setAttribute("givePowerBookList", dao.findGivePowerInfoListFromCaseId(request.getParameter("cid")));
		 //证据先行登记保存通知书
		request.setAttribute("evidRigiNotiList", dao.findEvidRigiNotiListFromCaseId(request.getParameter("cid")));
		 //证据先行登记保存决定书
		request.setAttribute("evidDeciList", dao.findEvidDeciListFromCaseId(request.getParameter("cid")));
		 //案件延期处理报批表
		request.setAttribute("DelayInspect", dao.findDelayInspectByCaseId(request.getParameter("cid")));
		//案件撤销
		request.setAttribute("CaseNotApply", dao.findCaseNotApplyByCaseId(request.getParameter("cid")));
		//询问通知书
		request.setAttribute("querNotiInfoList", dao.findQuerNotiInfoListFromCaseId(request.getParameter("cid")));
		//询问笔录
		request.setAttribute("evidenceInfoList", dao.findEvidenceInfoListFromCaseId(request.getParameter("cid")));
		//处理审批
		request.setAttribute("disposalConsiderations", dao.findDisposalConsiderationsByCaseId(request.getParameter("cid")));
		//整改指令书
		request.setAttribute("disposalRectification", dao.findDisposalRectificationByCaseId(request.getParameter("cid")));
		//处罚告知书
		request.setAttribute("disposalNotice", dao.findDisposalNoticeByCaseId(request.getParameter("cid")));
		//处罚决定书
		request.setAttribute("disposalDecision", dao.findDisposalDecisionByCaseId(request.getParameter("cid")));
		 //案件讨论
		request.setAttribute("discussRecordList", dao.findDiscussRecordListFromCaseId(request.getParameter("cid")));
         //案件转移
		request.setAttribute("CaseChangeInsp", dao.findCaseChangeInspByCaseId(request.getParameter("cid")));
		//处罚跟踪
		request.setAttribute("disposalTrack", dao.findDisposalTrackByCaseId(request.getParameter("cid")));
        //		强制执行
		request.setAttribute("EnforceDo", dao.findEnforceDoByCaseId(request.getParameter("cid")));
		//送达回执
		request.setAttribute("receiptInfoList", dao.findReceiptInfoByCaseId(request.getParameter("cid")));
		//结案审批表
		request.setAttribute("applyEndcase", dao.findApplyEndcaseByCaseId(request.getParameter("cid")));
		return mapping.findForward("historyDetail");
	}
	
	/**
	 * 领导审批案件基本信息管理
	 */
	public ActionForward applyList(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		String scorp = "";
		SuperviseOrganDAO sdao = new SuperviseOrganDAO(request,response);
		List<UserManagerScope> infoList = sdao.findBySupCode(SystemSession.getSupUserId(request));
		if(infoList != null && infoList.size()>0){
			UserManagerScope info1 = infoList.get(0);
			scorp = info1.getUserManagerScopeOrganId();
		}
		if(scorp != null && scorp.length() > 0)
			scorp = scorp.replace(",", "','");
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		String caseInfoCode = request.getParameter("caseInfoCode");
		String empInfoName = request.getParameter("empInfoName");
		List list = dao.findPage(scorp, caseInfoCode, empInfoName);
		request.setAttribute("list", list);
		return mapping.findForward("applyList");
	}
	
	public ActionForward applyDetail(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		CaseInfo info = dao.findById(request.getParameter("cid"));
		request.setAttribute("cInfo", info);
		//立案审批表
		request.setAttribute("applyCase", dao.findApplyCaseByCaseId(request.getParameter("cid")));
        //授权委托书
		request.setAttribute("givePowerBookList", dao.findGivePowerInfoListFromCaseId(request.getParameter("cid")));
		 //证据先行登记保存通知书
		request.setAttribute("evidRigiNotiList", dao.findEvidRigiNotiListFromCaseId(request.getParameter("cid")));
		 //证据先行登记保存决定书
		request.setAttribute("evidDeciList", dao.findEvidDeciListFromCaseId(request.getParameter("cid")));
		 //案件延期处理报批表
		request.setAttribute("DelayInspect", dao.findDelayInspectByCaseId(request.getParameter("cid")));
		//案件撤销
		request.setAttribute("CaseNotApply", dao.findCaseNotApplyByCaseId(request.getParameter("cid")));
		//询问通知书
		request.setAttribute("querNotiInfoList", dao.findQuerNotiInfoListFromCaseId(request.getParameter("cid")));
		//询问笔录
		request.setAttribute("evidenceInfoList", dao.findEvidenceInfoListFromCaseId(request.getParameter("cid")));
       //案件讨论
		request.setAttribute("discussRecordList", dao.findDiscussRecordListFromCaseId(request.getParameter("cid")));
         //案件转移
		request.setAttribute("CaseChangeInsp", dao.findCaseChangeInspByCaseId(request.getParameter("cid")));
		//处理审批
		request.setAttribute("disposalConsiderations", dao.findDisposalConsiderationsByCaseId(request.getParameter("cid")));
		//整改指令书
		request.setAttribute("disposalRectification", dao.findDisposalRectificationByCaseId(request.getParameter("cid")));
		//处罚告知书
		request.setAttribute("disposalNotice", dao.findDisposalNoticeByCaseId(request.getParameter("cid")));
		//处罚决定书
		request.setAttribute("disposalDecision", dao.findDisposalDecisionByCaseId(request.getParameter("cid")));
		//处罚跟踪
		request.setAttribute("disposalTrack", dao.findDisposalTrackByCaseId(request.getParameter("cid")));
		//送达回执
		request.setAttribute("receiptInfoList", dao.findReceiptInfoByCaseId(request.getParameter("cid")));
//		强制执行
		request.setAttribute("EnforceDo", dao.findEnforceDoByCaseId(request.getParameter("cid")));
		//结案审批表
		request.setAttribute("applyEndcase", dao.findApplyEndcaseByCaseId(request.getParameter("cid")));
		return mapping.findForward("applyDetail");
	}
	
	/**
	 * 监察员案件基本信息管理
	 */
	
	public ActionForward list(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		String caseInfoMajorInspectorId = SystemSession.getSupUserId(request);
		String caseInfoCode = request.getParameter("caseInfoCode");
		String empInfoName = request.getParameter("empInfoName");
		List Blist = dao.findAllPage(caseInfoMajorInspectorId, caseInfoCode, empInfoName);
		Iterator i =  Blist.iterator();
		List<CaseInfo>  list= new ArrayList<CaseInfo>();
		while(i.hasNext()){
			CaseInfo ci = (CaseInfo)i.next();
			ci.setCaseBegin((System.currentTimeMillis()-ci.getCaseInfoBeginDate().getTime())/(24*60*60*1000));
			list.add(ci);
		}
//		SimpleDateFormat myFormatter = new SimpleDateFormat("yyyy-MM-dd"); 
//		java.util.Date date = ;
//		java.util.Date mydate;
//		try {
//			date = myFormatter.parse("2003-06-01");
//			mydate= myFormatter.parse("2003-05-01"); 
//		} catch (ParseException e) {
//			// TODO Auto-generated catch block
//			e.printStackTrace();
//		} 
//		long day=(date.getTime()-mydate.getTime())/(24*60*60*1000); 
//		System.out.println("相差的日期:" + day); 
		
		request.setAttribute("intPage", String.valueOf(dao.intPage));
		request.setAttribute("list", list);
		return mapping.findForward("list");
	}
	
	public ActionForward detail(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		CaseInfo info = dao.findById(request.getParameter("cid"));
		request.setAttribute("cInfo", info);
		//立案审批表
		request.setAttribute("applyCase", dao.findApplyCaseByCaseId(request.getParameter("cid")));
		//询问通知书
		request.setAttribute("querNotiInfoList", dao.findQuerNotiInfoListFromCaseId(request.getParameter("cid")));
		//授权委托书
		request.setAttribute("givePowerBookList", dao.findGivePowerInfoListFromCaseId(request.getParameter("cid")));
        //证据先行登记保存通知书
		request.setAttribute("evidRigiNotiList", dao.findEvidRigiNotiListFromCaseId(request.getParameter("cid")));
		 //证据先行登记保存决定书
		request.setAttribute("evidDeciList", dao.findEvidDeciListFromCaseId(request.getParameter("cid")));
		 //案件延期处理报批表
		request.setAttribute("DelayInspect", dao.findDelayInspectByCaseId(request.getParameter("cid")));
         //案件撤销立案审批表
		request.setAttribute("CaseNotApply", dao.findCaseNotApplyByCaseId(request.getParameter("cid")));
		//询问笔录
		request.setAttribute("evidenceInfoList", dao.findEvidenceInfoListFromCaseId(request.getParameter("cid")));
        //案件讨论
		request.setAttribute("discussRecordList", dao.findDiscussRecordListFromCaseId(request.getParameter("cid")));
        //案件转移
		request.setAttribute("CaseChangeInsp", dao.findCaseChangeInspByCaseId(request.getParameter("cid")));
		//强制执行
		request.setAttribute("EnforceDo", dao.findEnforceDoByCaseId(request.getParameter("cid")));
		//处理审批
		request.setAttribute("disposalConsiderations", dao.findDisposalConsiderationsByCaseId(request.getParameter("cid")));
		//整改指令书
		request.setAttribute("disposalRectification", dao.findDisposalRectificationByCaseId(request.getParameter("cid")));
		//处罚告知书
		request.setAttribute("disposalNotice", dao.findDisposalNoticeByCaseId(request.getParameter("cid")));
		//处罚决定书
		request.setAttribute("disposalDecision", dao.findDisposalDecisionByCaseId(request.getParameter("cid")));
		//处罚跟踪
		request.setAttribute("disposalTrack", dao.findDisposalTrackByCaseId(request.getParameter("cid")));
		//送达回执
		request.setAttribute("receiptInfoList", dao.findReceiptInfoByCaseId(request.getParameter("cid")));
		//结案审批表
		request.setAttribute("applyEndcase", dao.findApplyEndcaseByCaseId(request.getParameter("cid")));
		return mapping.findForward("detail");
	}
	
	public ActionForward toAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		return mapping.findForward("toAdd");
	}
	
	public ActionForward toUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		CaseInfo info = dao.findById(request.getParameter("cid"));
		request.setAttribute("nowPage",request.getParameter("page"));
		request.setAttribute("cInfo", info);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward update(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoForm cForm = (CaseInfoForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		CaseInfo info = dao.findById(request.getParameter("cid"));
		EmployerInfoDAO eDao = new EmployerInfoDAO(request, response);
		EmployerInfo eInfo = eDao.findById(cForm.getCaseInfoUnitId());
		info.setEmployerInfo(eInfo);
//		info.setCaseInfoCode(cForm.getCaseInfoCode());
		info.setCaseInfoProperty(cForm.getCaseInfoProperty());
		info.setCaseInfoSource(cForm.getCaseInfoSource());
		info.setCaseInfoOrigin(cForm.getCaseInfoOrigin());
		info.setCaseInfoBasiccondiBeginres(cForm.getCaseInfoBasiccondiBeginres());
		info.setCaseInfoRemark(cForm.getCaseInfoRemark());
		dao.merge(info);
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "CaseInfo.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()).replace("$record", info.getCaseInfoCode()));
		logDao.save(s);
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/CaseInfo.do?method=list&pages="+request.getParameter("pages"), true);
	}
	
	public ActionForward add(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoForm cForm = (CaseInfoForm)form;
		CaseInfo info = new CaseInfo();
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");
	    String year = df.format(new Date());
	    String caseInfoCode = "001";
	    int code = dao.findMaxCode(year) + 1;
	    if(code < 10)
	    	caseInfoCode = "00" + code;
	    else if(code < 100)
	    	caseInfoCode = "0" + code;
	    caseInfoCode = year + caseInfoCode;
		EmployerInfoDAO eDao = new EmployerInfoDAO(request, response);
		PersionFileDAO pDao = new PersionFileDAO(request, response);
		EmployerInfo eInfo = eDao.findById(cForm.getCaseInfoUnitId());
		PersionFile persionFile = pDao.findById(SystemSession.getSupUserId(request));
		info.setEmployerInfo(eInfo);
		info.setCaseInfoCode(caseInfoCode);
		info.setCaseInfoProperty(cForm.getCaseInfoProperty());
		info.setCaseInfoSource(cForm.getCaseInfoSource());
		info.setCaseInfoOrigin(cForm.getCaseInfoOrigin());
		info.setCaseInfoBasiccondiBeginres(cForm.getCaseInfoBasiccondiBeginres());
		info.setCaseInfoRemark(cForm.getCaseInfoRemark());
		info.setPersionFile(persionFile);		
		info.setCaseInfoBeginDate(new Date());		
		info.setCaseInfoCasestate("0");
		info.setCaseInfoAssisInsepectorId(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		dao.save(info);
		
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "CaseInfo.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()).replace("$record", info.getCaseInfoCode()));
		logDao.save(s);
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/CaseInfo.do?method=list", true);
	}
	
	public ActionForward delete(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		String caseInfoMajorInspectorId = SystemSession.getSupUserId(request);
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		List list = dao.findFromIdArray(caseInfoMajorInspectorId, request.getParameterValues("cid"));
		if(list != null && list.size() > 0){
			for(int i = 0; i < list.size(); i ++){
				CaseInfo info = (CaseInfo)list.get(i);
				dao.delete(info);
			}
		}
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("2");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "CaseInfo.delete").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/CaseInfo.do?method=list", true);
	}
	
	/**
	 * 立案申请(审批)模块
	 */
	//申请立案 添加立案申请基本信息 监察员
	public ActionForward toApplyCaseAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addApplyCase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ApplyCaseForm aForm = (ApplyCaseForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ApplyCase acase = new ApplyCase();
		acase.setApplyCaseCaseid(aForm.getApplyCaseCaseid());
		acase.setApplyCaseInspectorAdvise(aForm.getApplyCaseInspectorAdvise());
		acase.setApplyCaseInspectorId(SystemSession.getSupUserId(request));
		acase.setApplyCaseAddress(aForm.getApplyCaseAddress());
		acase.setApplyCaseCode(aForm.getApplyCaseCode());
		acase.setApplyCaseLawOthertel(aForm.getApplyCaseLawOthertel());
		acase.setApplyCaseLawPduty(aForm.getApplyCaseLawPduty());
		acase.setApplyCaseLawPname(aForm.getApplyCaseLawPname());
		acase.setApplyCaseLawPrimduty(aForm.getApplyCaseLawPrimduty());
		acase.setApplyCaseLawPrimname(aForm.getApplyCaseLawPrimname());
		acase.setApplyCaseLawPrimtel(aForm.getApplyCaseLawPrimtel());
		acase.setApplyCaseLawPtel(aForm.getApplyCaseLawPrimtel());
		acase.setApplyCaseName(aForm.getApplyCaseName());
		acase.setApplyCaseInspIfApprove("0");
		acase.setApplyCaseInspectorDate(new Date());
		//将立案状态修改为立案审批
		CaseInfo info = dao.findById(aForm.getApplyCaseCaseid());
		info.setCaseInfoCasestate("1");
		
		dao.save(acase);
		dao.merge(info);
		
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("8");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "addApplyCase").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()).replace("$record", info.getCaseInfoCode()));
		logDao.save(s);
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/ApplyCase.do?method=detailApplyCase&aid=" + acase.getApplyCaseId(), true);
	}
	
	//修改立案信息 监察员
	public ActionForward toApplyCaseUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ApplyCase acase = dao.findApplyCaseById(request.getParameter("aid"));
		if(acase.getApplyCaseInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(acase.getApplyCaseInspectorId());
			request.setAttribute("p1", p1);
		}
		request.setAttribute("acase", acase);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateApplyCase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ApplyCaseForm aForm = (ApplyCaseForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ApplyCase acase = dao.findApplyCaseById(request.getParameter("aid"));
		acase.setApplyCaseInspectorAdvise(aForm.getApplyCaseInspectorAdvise());
		acase.setApplyCaseAddress(aForm.getApplyCaseAddress());
		acase.setApplyCaseCode(aForm.getApplyCaseCode());
		acase.setApplyCaseLawOthertel(aForm.getApplyCaseLawOthertel());
		acase.setApplyCaseLawPduty(aForm.getApplyCaseLawPduty());
		acase.setApplyCaseLawPname(aForm.getApplyCaseLawPname());
		acase.setApplyCaseLawPrimduty(aForm.getApplyCaseLawPrimduty());
		acase.setApplyCaseLawPrimname(aForm.getApplyCaseLawPrimname());
		acase.setApplyCaseLawPrimtel(aForm.getApplyCaseLawPrimtel());
		acase.setApplyCaseLawPtel(aForm.getApplyCaseLawPrimtel());
		acase.setApplyCaseName(aForm.getApplyCaseName());	
		dao.merge(acase);
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/ApplyCase.do?method=detailApplyCase&aid=" + acase.getApplyCaseId(), true);
	}
	
	//审批立案信息 领导
	public ActionForward toApplyCaseApply(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ApplyCase acase = dao.findApplyCaseById(request.getParameter("aid"));
		if(acase.getApplyCaseInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(acase.getApplyCaseInspectorId());
			request.setAttribute("p1", p1);
		}
		request.setAttribute("acase", acase);
		return mapping.findForward("toApply");
	}
	
	public ActionForward applyApplyCase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ApplyCaseForm aForm = (ApplyCaseForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ApplyCase acase = dao.findApplyCaseById(request.getParameter("aid"));
		acase.setApplyCaseInspectionLeadAdv(aForm.getApplyCaseInspectionLeadAdv());
		acase.setApplyCaseInspectionLeadIdi(SystemSession.getSupUserId(request));
		acase.setApplyCaseInspIfApprove(aForm.getApplyCaseInspIfApprove());
		acase.setApplyCaseInspectionLeaDate(new Date());
		
		CaseInfo info = dao.findById(acase.getApplyCaseCaseid());
		//如果同意立案 将立案状态修改为调查取证
		if("1".equals(acase.getApplyCaseInspIfApprove())){
			info.setCaseInfoCasestate("2");
		//如果不同意立案 将立案状态修改为不予以受理
		}else if("2".equals(acase.getApplyCaseInspIfApprove())){
			info.setCaseInfoCasestate("7");
			info.setCaseInfoEndDate(new Date());
		}
		dao.merge(acase);
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("9");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "applyApplyCase").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()).replace("$record", info.getCaseInfoCode()).replace("$record", info.getCaseInfoCode()));
		logDao.save(s);
		return new ActionForward("/ApplyCase.do?method=detailApplyCase&aid=" + acase.getApplyCaseId(), true);
	}
	
	//立案信息详细页面
	public ActionForward detailApplyCase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		ApplyCase acase = dao.findApplyCaseById(request.getParameter("aid"));
		if(acase.getApplyCaseInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(acase.getApplyCaseInspectorId());
			request.setAttribute("p1", p1);
		}
		if(acase.getApplyCaseInspectionLeadIdi() != null){
			PersionFile p2 = dao.findPersionFileById(acase.getApplyCaseInspectionLeadIdi());
			request.setAttribute("p2", p2);
		}
		request.setAttribute("acase", acase);
		return mapping.findForward("detail");
	}
	
	//立案申请表下载
	public ActionForward docApplyCase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		ApplyCase acase = dao.findApplyCaseById(request.getParameter("aid"));
		request.setAttribute("ci", dao.findById(acase.getApplyCaseCaseid()));
		if(acase.getApplyCaseInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(acase.getApplyCaseInspectorId());
			request.setAttribute("p1", p1);
		}
		if(acase.getApplyCaseInspectionLeadIdi() != null){
			PersionFile p2 = dao.findPersionFileById(acase.getApplyCaseInspectionLeadIdi());
			request.setAttribute("p2", p2);
		}
		request.setAttribute("acase", acase);
		return mapping.findForward("doc");
	}
	
	
	
	
	/**
	 * 案件延期申请(审批)模块
	 */
	//申请案件延期 添加案件延期基本信息 监察员
	public ActionForward toDelayInspectAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addDelayInspect(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DelayInspectForm dForm = (DelayInspectForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DelayInspect di = new DelayInspect();
		di.setDelayInspectCaseId(dForm.getDelayInspectCaseId());
		di.setDelayInspectInspectorDate(new Date());
		di.setDelayInspectInspectorId(SystemSession.getSupUserId(request));
		di.setDelayInspectInspectorRes(dForm.getDelayInspectInspectorRes());
		di.setDelayInspectOganIfagree("0");
		dao.save(di);
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("8");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DelayInspect.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/DelayInspect.do?method=detailDelayInspect&did=" + di.getId(), true);
	}
	
	//修改案件延期 监察员
	public ActionForward toDelayInspectUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DelayInspect di = dao.findDelayInspectById(request.getParameter("did"));
		if(di.getDelayInspectInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(di.getDelayInspectInspectorId());
			request.setAttribute("p1", p1);
		}
		request.setAttribute("di", di);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateDelayInspect(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DelayInspectForm dForm = (DelayInspectForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DelayInspect di = dao.findDelayInspectById(dForm.getId());
		di.setDelayInspectInspectorRes(dForm.getDelayInspectInspectorRes());
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DelayInspect.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		dao.getSession().flush();
		dao.getSession().clear();
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/DelayInspect.do?method=detailDelayInspect&did=" + di.getId(), true);
	}
	
	//审批案件延期 领导
	public ActionForward toDelayInspectApply(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DelayInspect di = dao.findDelayInspectById(request.getParameter("did"));
		if(di.getDelayInspectInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(di.getDelayInspectInspectorId());
			request.setAttribute("p1", p1);
		}
		request.setAttribute("di", di);
		return mapping.findForward("toApply");
	}
	
	public ActionForward applyDelayInspect(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DelayInspectForm dForm = (DelayInspectForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DelayInspect di = dao.findDelayInspectById(dForm.getId());
		di.setDelayInspectOganDate(new Date());
		di.setDelayInspectOganId(SystemSession.getSupUserId(request));
		di.setDelayInspectOganIfagree(dForm.getDelayInspectOganIfagree());
		di.setDelayInspectOganRes(dForm.getDelayInspectOganRes());
		
		CaseInfo info = dao.findById(di.getDelayInspectCaseId());
		//如果同意案件延期 将案件状态修改为延期状态
		if("1".equals(di.getDelayInspectOganIfagree())){
			info.setCaseInfoCasestate("9");
		//如果不同意延期 将立案状态不变
		}else if("2".equals(di.getDelayInspectOganIfagree())){
			info.setCaseInfoCasestate("2");
		}
		dao.merge(di);
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("9");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DelayInspect").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()).replace("$record", info.getCaseInfoCode()).replace("$record", info.getCaseInfoCode()));
		logDao.save(s);
		return new ActionForward("/DelayInspect.do?method=detailDelayInspect&did=" + di.getId(), true);
	}
	
	//案件延期详细页面
	public ActionForward detailDelayInspect(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DelayInspect di = dao.findDelayInspectById(request.getParameter("did"));
		if(di.getDelayInspectInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(di.getDelayInspectInspectorId());
			request.setAttribute("p1", p1);
		}
		if(di.getDelayInspectOganId() != null){
			PersionFile p2 = dao.findPersionFileById(di.getDelayInspectOganId());
			request.setAttribute("p2", p2);
		}
		request.setAttribute("di", di);
		return mapping.findForward("detail");
	}
	
	//案件延期表下载
	public ActionForward docDelayInspect(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DelayInspect di = dao.findDelayInspectById(request.getParameter("did"));
		CaseInfo ci = dao.findById(di.getDelayInspectCaseId());
		ApplyCase acase = dao.findApplyCaseByCaseId(ci.getCaseInfoId());
		request.setAttribute("ci", ci);
		request.setAttribute("eInfo",ci.getEmployerInfo());
		request.setAttribute("di", di);
		if(acase.getApplyCaseInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(acase.getApplyCaseInspectorId());
			request.setAttribute("p1", p1);
		}
		if(acase.getApplyCaseInspectionLeadIdi() != null){
			PersionFile p2 = dao.findPersionFileById(acase.getApplyCaseInspectionLeadIdi());
			request.setAttribute("p2", p2);
		}
		request.setAttribute("acase", acase);
		return mapping.findForward("doc");
	}
	
	
	
	/**
	 * 撤销立案申请(审批)模块
	 */
	//申请案件延期 添加撤销立案申请 监察员
	public ActionForward toCaseNotApplyAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addCaseNotApply(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseNotApplyForm cForm = (CaseNotApplyForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		CaseNotApply cna = new CaseNotApply();
		cna.setCaseNotApplyAccord(cForm.getCaseNotApplyAccord());
		cna.setCaseNotApplyCaseId(cForm.getCaseNotApplyCaseId());
		cna.setCaseNotApplyInspectorAdvis(cForm.getCaseNotApplyInspectorAdvis());
		cna.setCaseNotApplyInspectorDate(new Date());
//		cna.setCaseNotApplyNum(cForm.getCaseNotApplyNum());
		cna.setCaseNotApplyRemark(cForm.getCaseNotApplyRemark());
		cna.setCaseNotApplyIfagree("0");
		cna.setCaseNotApplyInspectorId(SystemSession.getSupUserId(request));
		dao.save(cna);
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("8");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "CaseNotApply.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/CaseNotApply.do?method=detailCaseNotApply&did=" + cna.getId(), true);
	}
	
	//修改撤销立案 监察员
	public ActionForward toCaseNotApplyUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		CaseNotApply cna = dao.findCaseNotApplyById(request.getParameter("did"));
		if(cna.getCaseNotApplyInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(cna.getCaseNotApplyInspectorId());
			request.setAttribute("p1", p1);
		}
		request.setAttribute("cna", cna);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateCaseNotApply(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseNotApplyForm cForm = (CaseNotApplyForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		CaseNotApply cna = dao.findCaseNotApplyById(cForm.getId());
		cna.setCaseNotApplyAccord(cForm.getCaseNotApplyAccord());
		cna.setCaseNotApplyInspectorAdvis(cForm.getCaseNotApplyInspectorAdvis());
		cna.setCaseNotApplyRemark(cForm.getCaseNotApplyRemark());
		dao.merge(cna);
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "CaseNotApply.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/CaseNotApply.do?method=detailCaseNotApply&did=" + cna.getId(), true);
	}
	
	//审批撤销立案 领导
	public ActionForward toApplyCaseNotApply(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		CaseNotApply cna = dao.findCaseNotApplyById(request.getParameter("did"));
		if(cna.getCaseNotApplyInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(cna.getCaseNotApplyInspectorId());
			request.setAttribute("p1", p1);
		}
		request.setAttribute("cna", cna);
		return mapping.findForward("toApply");
	}
	
	public ActionForward applyCaseNotApply(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseNotApplyForm cForm = (CaseNotApplyForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		CaseNotApply cna = dao.findCaseNotApplyById(cForm.getId());
		cna.setCaseNotApplyIfagree(cForm.getCaseNotApplyIfagree());
		cna.setCaseNotApplyOagnId(SystemSession.getSupUserId(request));
		cna.setCaseNotApplyOganDate(new Date());
		cna.setCaseNotApplyOganAdvise(cForm.getCaseNotApplyOganAdvise());
		CaseInfo info = dao.findById(cna.getCaseNotApplyCaseId());
		//如果同意撤销立案 将案件转移到案件历史
		if("1".equals(cna.getCaseNotApplyIfagree())){
			info.setCaseInfoCasestate("6");
		//如果不同意案件撤销 将立案状态不变
		}else if("2".equals(cna.getCaseNotApplyIfagree())){
			info.setCaseInfoCasestate("2");
			info.setCaseInfoEndDate(new Date());
		}
		dao.merge(cna);
		dao.merge(info);
		
		
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("9");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "CaseNotApply").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()).replace("$record", info.getCaseInfoCode()).replace("$record", info.getCaseInfoCode()));
		logDao.save(s);
		
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/CaseNotApply.do?method=detailCaseNotApply&did=" + cna.getId(), true);
	}
	
	//撤销立案详细页面
	public ActionForward detailCaseNotApply(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		CaseNotApply cna = dao.findCaseNotApplyById(request.getParameter("did"));
		if(cna.getCaseNotApplyInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(cna.getCaseNotApplyInspectorId());
			request.setAttribute("p1", p1);
		}
		if(cna.getCaseNotApplyOagnId() != null){
			PersionFile p2 = dao.findPersionFileById(cna.getCaseNotApplyOagnId());
			request.setAttribute("p2", p2);
		}
		request.setAttribute("cna", cna);
		return mapping.findForward("detail");
	}
	
	//撤销立案表下载
	public ActionForward docCaseNotApply(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		CaseNotApply cna = dao.findCaseNotApplyById(request.getParameter("did"));
		CaseInfo ci = dao.findById(cna.getCaseNotApplyCaseId());
		ApplyCase acase = dao.findApplyCaseByCaseId(ci.getCaseInfoId());
		request.setAttribute("ci", ci);
		request.setAttribute("eInfo",ci.getEmployerInfo());
		request.setAttribute("cna", cna);
		if(acase.getApplyCaseInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(acase.getApplyCaseInspectorId());
			request.setAttribute("p1", p1);
		}
		if(acase.getApplyCaseInspectionLeadIdi() != null){
			PersionFile p2 = dao.findPersionFileById(acase.getApplyCaseInspectionLeadIdi());
			request.setAttribute("p2", p2);
		}
		request.setAttribute("acase", acase);
		return mapping.findForward("doc");
	}
	
	
	/**
	 * 不予以受理决定书
	 */
	
	//添加不予以受理决定书
	public ActionForward toRefuseCaseAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("cInfo", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addRefuseCase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		RefuseCaseForm rForm = (RefuseCaseForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		RefuseCase info = new RefuseCase();
		CaseInfo Cinfo = dao.findById(rForm.getRefuseCaseCaseId());
		info.setRefuseCaseAccord(rForm.getRefuseCaseAccord());
		info.setRefuseCaseCaseId(rForm.getRefuseCaseCaseId());
		info.setRefuseCaseDay(rForm.getRefuseCaseDay());
		info.setRefuseCaseMonth(rForm.getRefuseCaseMonth());
		info.setRefuseCaseTellsth(rForm.getRefuseCaseTellsth());
		info.setRefuseCaseYear(rForm.getRefuseCaseYear());
		info.setRefuseCaseDh(rForm.getRefuseCaseDh());
		info.setRefuseCaseTz(rForm.getRefuseCaseTz());
		Cinfo.setCaseInfoCasestate("6");
		dao.save(info);
		dao.merge(Cinfo);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "RefuseCase.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/RefuseCase.do?method=detailRefuseCase&rid=" + info.getId(), true);
	}
	
	//不予以受理决定书详细页面
	public ActionForward detailRefuseCase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		RefuseCase info = dao.findRefuseCaseById(request.getParameter("rid"));
		request.setAttribute("rInfo", info);
		return mapping.findForward("detail");
	}
	
	//不予以受理决定书下载
	public ActionForward docRefuseCase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		RefuseCase info = dao.findRefuseCaseById(request.getParameter("rid"));
		ApplyCase acase = dao.findApplyCaseByCaseId(info.getRefuseCaseCaseId());
		CaseInfo Cinfo = dao.findById(info.getRefuseCaseCaseId());
		request.setAttribute("rInfo", info);
		request.setAttribute("acase", acase);
		request.setAttribute("Cinfo", Cinfo);
		return mapping.findForward("doc");
	}
	
	
	/**
	 * 询问通知书
	 */
	
	//添加询问通知书
	public ActionForward toQuerNotiInfoAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("cInfo", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addQuerNotiInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		QuerNotiInfoForm qForm = (QuerNotiInfoForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		QuerNotiInfo info = new QuerNotiInfo();
		info.setQuerNotiInfoCaseId(qForm.getQuerNotiInfoCaseId());
		info.setQuerNotiInfoProvName(qForm.getQuerNotiInfoProvName());
		info.setQuerNotiInfoInspNum(qForm.getQuerNotiInfoInspNum());
		info.setQuerNotiInfoUnitName(qForm.getQuerNotiInfoUnitName());
		info.setQuerNotiInfoCaseOrigin(qForm.getQuerNotiInfoCaseOrigin());
		info.setQuerNotiInfoQueryYear(qForm.getQuerNotiInfoQueryYear());
		info.setQuerNotiInfoQueryMonth(qForm.getQuerNotiInfoQueryMonth());
		info.setQuerNotiInfoQueryDay(qForm.getQuerNotiInfoQueryDay());
		info.setQuerNotiInfoQueryHour(qForm.getQuerNotiInfoQueryHour());
		info.setQuerNotiInfoQueryMinute(qForm.getQuerNotiInfoQueryMinute());
		info.setQuerNotiInfoLabBur(qForm.getQuerNotiInfoLabBur());
		info.setQuerNotiInfoAddress(qForm.getQuerNotiInfoAddress());
		info.setQuerNotiInfoPhone(qForm.getQuerNotiInfoPhone());
		info.setQuerNotiInfoFile(qForm.getQuerNotiInfoFile());
		info.setQuerNotiInfoYear(qForm.getQuerNotiInfoYear());
		info.setQuerNotiInfoMonth(qForm.getQuerNotiInfoMonth());
		info.setQuerNotiInfoDay(qForm.getQuerNotiInfoDay());
		info.setQuerNitiInfoPerson(qForm.getQuerNitiInfoPerson());
		info.setQuerNotiInfoCreateDate(new Date());
		dao.save(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "QuerNotiInfo.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/QuerNotiInfo.do?method=detailQuerNotiInfo&qid=" + info.getQuerNotiInfoId(), true);
	}
	

	
	//修改询问通知书
	public ActionForward toQuerNotiInfoUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		QuerNotiInfo info = dao.findQuerNotiInfoById(request.getParameter("qid"));
		request.setAttribute("qInfo", info);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateQuerNotiInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		QuerNotiInfoForm qForm = (QuerNotiInfoForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		QuerNotiInfo info = dao.findQuerNotiInfoById(request.getParameter("qid"));
		info.setQuerNotiInfoProvName(qForm.getQuerNotiInfoProvName());
		info.setQuerNotiInfoInspNum(qForm.getQuerNotiInfoInspNum());
		info.setQuerNotiInfoUnitName(qForm.getQuerNotiInfoUnitName());
		info.setQuerNotiInfoCaseOrigin(qForm.getQuerNotiInfoCaseOrigin());
		info.setQuerNotiInfoQueryYear(qForm.getQuerNotiInfoQueryYear());
		info.setQuerNotiInfoQueryMonth(qForm.getQuerNotiInfoQueryMonth());
		info.setQuerNotiInfoQueryDay(qForm.getQuerNotiInfoQueryDay());
		info.setQuerNotiInfoQueryHour(qForm.getQuerNotiInfoQueryHour());
		info.setQuerNotiInfoQueryMinute(qForm.getQuerNotiInfoQueryMinute());
		info.setQuerNotiInfoLabBur(qForm.getQuerNotiInfoLabBur());
		info.setQuerNotiInfoAddress(qForm.getQuerNotiInfoAddress());
		info.setQuerNotiInfoPhone(qForm.getQuerNotiInfoPhone());
		info.setQuerNotiInfoFile(qForm.getQuerNotiInfoFile());
		info.setQuerNotiInfoYear(qForm.getQuerNotiInfoYear());
		info.setQuerNotiInfoMonth(qForm.getQuerNotiInfoMonth());
		info.setQuerNitiInfoPerson(qForm.getQuerNitiInfoPerson());
		info.setQuerNotiInfoDay(qForm.getQuerNotiInfoDay());
				
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "QuerNotiInfo.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		
		return new ActionForward("/QuerNotiInfo.do?method=detailQuerNotiInfo&qid=" + info.getQuerNotiInfoId(), true);
	}
	
	//询问通知书详细页面
	public ActionForward detailQuerNotiInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		QuerNotiInfo info = dao.findQuerNotiInfoById(request.getParameter("qid"));
		request.setAttribute("qInfo", info);
		return mapping.findForward("detail");
	}
	
	//删除询问通知书
	public ActionForward deleteQuerNotiInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		QuerNotiInfo info = dao.findQuerNotiInfoById(request.getParameter("qid"));
		String cid = info.getQuerNotiInfoCaseId();
		dao.delete(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("2");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "QuerNotiInfo.delete").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/CaseInfo.do?method=detail&cid=" + cid, true);
	}
	
	
	public ActionForward docQuerNotiInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		QuerNotiInfo info = dao.findQuerNotiInfoById(request.getParameter("qid"));
		request.setAttribute("qInfo", info);
		return mapping.findForward("doc");
	}
	
	
	/**
	 * 授权委托书
	 */
	
	//添加授权委托书
	public ActionForward toGivePowerBookInfoAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("cInfo", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addGivePowerBookInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		GivePowerBookForm gForm = (GivePowerBookForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		GivePowerBook info = new GivePowerBook();
		info.setGivePowerBookCaseId(gForm.getGivePowerBookCaseId());
		info.setGivePowerDay(gForm.getGivePowerDay());
		info.setGivePowerDosth(gForm.getGivePowerDosth());
	    info.setGivePowerLawpresentduty(gForm.getGivePowerLawpresentduty());
	    info.setGivePowerLawpresentTel(gForm.getGivePowerLawpresentTel());
	    info.setGivePowerManage(gForm.getGivePowerManage());
	    info.setGivePowerMonth(gForm.getGivePowerMonth());
	    info.setGivePowerPersonduty(gForm.getGivePowerPersonduty());
	    info.setGivePowerPersonname(gForm.getGivePowerPersonname());
	    info.setGivePowerPersonSex(gForm.getGivePowerPersonSex());
	    info.setGivePowerPersontel(gForm.getGivePowerPersontel());
	    info.setGivePowerUnit(gForm.getGivePowerUnit());
	    info.setGivePowerUnitAddress(gForm.getGivePowerUnitAddress());
	    info.setGivePowerUnitLawpresent(gForm.getGivePowerUnitLawpresent());
	    info.setGivePowerUnitName(gForm.getGivePowerUnitName());
	    info.setGivePowerYear(gForm.getGivePowerYear());
		info.setGivePowerDate(new Date());
		dao.save(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "GivePowerBookInfo.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/GivePowerBookInfo.do?method=detailGivePowerBookInfo&gid=" + info.getGivePowerId(), true);
	}
	
	//修改授权委托书
	public ActionForward toGivePowerBookInfoUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		GivePowerBook info = dao.findGivePowerBookById(request.getParameter("gid"));
		request.setAttribute("gInfo", info);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateGivePowerBookInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		GivePowerBookForm gForm = (GivePowerBookForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		GivePowerBook info = dao.findGivePowerBookById(request.getParameter("givePowerId"));
		info.setGivePowerDay(gForm.getGivePowerDay());
		info.setGivePowerDosth(gForm.getGivePowerDosth());
	    info.setGivePowerLawpresentduty(gForm.getGivePowerLawpresentduty());
	    info.setGivePowerLawpresentTel(gForm.getGivePowerLawpresentTel());
	    info.setGivePowerManage(gForm.getGivePowerManage());
	    info.setGivePowerMonth(gForm.getGivePowerMonth());
	    info.setGivePowerPersonduty(gForm.getGivePowerPersonduty());
	    info.setGivePowerPersonname(gForm.getGivePowerPersonname());
	    info.setGivePowerPersonSex(gForm.getGivePowerPersonSex());
	    info.setGivePowerPersontel(gForm.getGivePowerPersontel());
	    info.setGivePowerUnit(gForm.getGivePowerUnit());
	    info.setGivePowerUnitAddress(gForm.getGivePowerUnitAddress());
	    info.setGivePowerUnitLawpresent(gForm.getGivePowerUnitLawpresent());
	    info.setGivePowerUnitName(gForm.getGivePowerUnitName());
	    info.setGivePowerYear(gForm.getGivePowerYear());
				
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "GivePowerBookInfo.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/GivePowerBookInfo.do?method=detailGivePowerBookInfo&gid=" + info.getGivePowerId(), true);
	}
	
	//授权委托详细页面
	public ActionForward detailGivePowerBookInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		GivePowerBook info = dao.findGivePowerBookById(request.getParameter("gid"));
		request.setAttribute("gInfo", info);
		return mapping.findForward("detail");
	}
	
	//删除授权委托书
	public ActionForward deleteGivePowerBookInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
//		System.out.println(request.getParameter("gid"));
		GivePowerBook info = dao.findGivePowerBookById(request.getParameter("gid"));
		String cid = info.getGivePowerBookCaseId();
		dao.delete(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("2");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "GivePowerBookInfo.delete").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/CaseInfo.do?method=detail&cid=" + cid, true);
	}
	
	
	public ActionForward docGivePowerBookInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		GivePowerBook info = dao.findGivePowerBookById(request.getParameter("gid"));
		request.setAttribute("gInfo", info);
		return mapping.findForward("doc");
	}
	
	
	/**
	 * 证据先行登记保存通知书
	 */
	
	//添加登记保存通知书
	public ActionForward toEvidRigiInfoAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("cid", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addEvidRigiInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		EvidRigiNotiForm eForm = (EvidRigiNotiForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidRigiNoti info = new EvidRigiNoti();
		StringBuffer evidRigiNotiCodeStrBuffer = new StringBuffer();
		StringBuffer evidRigiNotiNameStrBuffer = new StringBuffer();
		StringBuffer evidRigiNotiCountStrBuffer = new StringBuffer();
		StringBuffer evidRigiNotiRemarkStrBuffer = new StringBuffer();
		String [] evidRigiNotiCode = request.getParameterValues("evidRigiNotiCode");
		String [] evidRigiNotiName = request.getParameterValues("evidRigiNotiName");
		String [] evidRigiNotiCount = request.getParameterValues("evidRigiNotiCount");
		String [] evidRigiNotiRemark = request.getParameterValues("evidRigiNotiRemark");
		for(int i=0;i<evidRigiNotiCode.length; i++){
			evidRigiNotiCodeStrBuffer.append(";"+evidRigiNotiCode[i]);
			evidRigiNotiNameStrBuffer.append(";"+evidRigiNotiCode[i]);
			evidRigiNotiCountStrBuffer.append(";"+evidRigiNotiCode[i]);
			evidRigiNotiRemarkStrBuffer.append(";"+evidRigiNotiCode[i]);
		}
		String evidRigiNotiCodeStr = evidRigiNotiCodeStrBuffer.substring(1);
		String evidRigiNotiNameStr = evidRigiNotiNameStrBuffer.substring(1);
		String evidRigiNotiCountStr = evidRigiNotiCountStrBuffer.substring(1);
		String evidRigiNotiRemarkStr = evidRigiNotiRemarkStrBuffer.substring(1);
		info.setEvidRigiNotiCaseId(eForm.getEvidRigiNotiCaseId());
		info.setEvidRigiNotiCode(evidRigiNotiCodeStr);
		info.setEvidRigiNotiCount(evidRigiNotiCountStr);
		info.setEvidRigiNotiDay(eForm.getEvidRigiNotiDay());
		info.setEvidRigiNotiEndDay(eForm.getEvidRigiNotiEndDay());
		info.setEvidRigiNotiEndMonth(eForm.getEvidRigiNotiEndMonth());
		info.setEvidRigiNotiEndYear(eForm.getEvidRigiNotiEndYear());
		info.setEvidRigiNotiInspeDay(eForm.getEvidRigiNotiInspeDay());
		info.setEvidRigiNotiInspeMonth(eForm.getEvidRigiNotiInspeMonth());
		info.setEvidRigiNotiInspeYear(eForm.getEvidRigiNotiInspeYear());
		info.setEvidRigiNotiMonth(eForm.getEvidRigiNotiMonth());
		info.setEvidRigiNotiName(evidRigiNotiNameStr);
		info.setEvidRigiNotiNum(eForm.getEvidRigiNotiNum());
		info.setEvidRigiNotiOgan(eForm.getEvidRigiNotiOgan());
		info.setEvidRigiNotiOganDay(eForm.getEvidRigiNotiOganDay());
		info.setEvidRigiNotiOganMonth(eForm.getEvidRigiNotiOganMonth());
		info.setEvidRigiNotiOganYear(eForm.getEvidRigiNotiOganYear());
		info.setEvidRigiNotiPlace(eForm.getEvidRigiNotiPlace());
		info.setEvidRigiNotiProvName(eForm.getEvidRigiNotiProvName());
		info.setEvidRigiNotiRemark(evidRigiNotiRemarkStr);
		info.setEvidRigiNotiTz(eForm.getEvidRigiNotiTz());
		info.setEvidRigiNotiWho(eForm.getEvidRigiNotiWho());
		info.setEvidRigiNotiWhoDay(eForm.getEvidRigiNotiWhoDay());
		info.setEvidRigiNotiWhoMonth(eForm.getEvidRigiNotiWhoMonth());
		info.setEvidRigiNotiWhoYear(eForm.getEvidRigiNotiWhoYear());
		info.setEvidRigiNotiYear(eForm.getEvidRigiNotiYear());
		dao.save(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EvidRigiNotiInfo.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/EvidRigiNotiInfo.do?method=detailEvidRigiInfo&eid="+info.getId(), true);
	}
	
	//修改证据先行登记保存通知书
	public ActionForward toEvidRigiInfoUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidRigiNoti info = dao.findEvidRigiNotiById(request.getParameter("eid"));
		request.setAttribute("evidRigiNotiCode", info.getEvidRigiNotiCode());
		request.setAttribute("evidRigiNotiName", info.getEvidRigiNotiName());
		request.setAttribute("evidRigiNotiCount", info.getEvidRigiNotiCount());
		request.setAttribute("evidRigiNotiRemark", info.getEvidRigiNotiRemark());
		request.setAttribute("eInfo", info);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateEvidRigiInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		EvidRigiNotiForm eForm = (EvidRigiNotiForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidRigiNoti info = dao.findEvidRigiNotiById(request.getParameter("id"));
		StringBuffer evidRigiNotiCodeStrBuffer = new StringBuffer();
		StringBuffer evidRigiNotiNameStrBuffer = new StringBuffer();
		StringBuffer evidRigiNotiCountStrBuffer = new StringBuffer();
		StringBuffer evidRigiNotiRemarkStrBuffer = new StringBuffer();
		String [] evidRigiNotiCode = request.getParameterValues("evidRigiNotiCode");
		String [] evidRigiNotiName = request.getParameterValues("evidRigiNotiName");
		String [] evidRigiNotiCount = request.getParameterValues("evidRigiNotiCount");
		String [] evidRigiNotiRemark = request.getParameterValues("evidRigiNotiRemark");
		for(int i=0;i<evidRigiNotiCode.length; i++){
			evidRigiNotiCodeStrBuffer.append(";"+evidRigiNotiCode[i]);
			evidRigiNotiNameStrBuffer.append(";"+evidRigiNotiName[i]);
			evidRigiNotiCountStrBuffer.append(";"+evidRigiNotiCount[i]);
			evidRigiNotiRemarkStrBuffer.append(";"+evidRigiNotiRemark[i]);
		}
		String evidRigiNotiCodeStr = evidRigiNotiCodeStrBuffer.substring(1);
		String evidRigiNotiNameStr = evidRigiNotiNameStrBuffer.substring(1);
		String evidRigiNotiCountStr = evidRigiNotiCountStrBuffer.substring(1);
		String evidRigiNotiRemarkStr = evidRigiNotiRemarkStrBuffer.substring(1);
		info.setEvidRigiNotiCode(evidRigiNotiCodeStr);
		info.setEvidRigiNotiCount(evidRigiNotiCountStr);
		info.setEvidRigiNotiDay(eForm.getEvidRigiNotiDay());
		info.setEvidRigiNotiEndDay(eForm.getEvidRigiNotiEndDay());
		info.setEvidRigiNotiEndMonth(eForm.getEvidRigiNotiEndMonth());
		info.setEvidRigiNotiEndYear(eForm.getEvidRigiNotiEndYear());
		info.setEvidRigiNotiInspeDay(eForm.getEvidRigiNotiInspeDay());
		info.setEvidRigiNotiInspeMonth(eForm.getEvidRigiNotiInspeMonth());
		info.setEvidRigiNotiInspeYear(eForm.getEvidRigiNotiInspeYear());
		info.setEvidRigiNotiMonth(eForm.getEvidRigiNotiMonth());
		info.setEvidRigiNotiName(evidRigiNotiNameStr);
		info.setEvidRigiNotiNum(eForm.getEvidRigiNotiNum());
		info.setEvidRigiNotiOgan(eForm.getEvidRigiNotiOgan());
		info.setEvidRigiNotiOganDay(eForm.getEvidRigiNotiOganDay());
		info.setEvidRigiNotiOganMonth(eForm.getEvidRigiNotiOganMonth());
		info.setEvidRigiNotiOganYear(eForm.getEvidRigiNotiOganYear());
		info.setEvidRigiNotiPlace(eForm.getEvidRigiNotiPlace());
		info.setEvidRigiNotiProvName(eForm.getEvidRigiNotiProvName());
		info.setEvidRigiNotiRemark(evidRigiNotiRemarkStr);
		info.setEvidRigiNotiTz(eForm.getEvidRigiNotiTz());
		info.setEvidRigiNotiWho(eForm.getEvidRigiNotiWho());
		info.setEvidRigiNotiWhoDay(eForm.getEvidRigiNotiWhoDay());
		info.setEvidRigiNotiWhoMonth(eForm.getEvidRigiNotiWhoMonth());
		info.setEvidRigiNotiWhoYear(eForm.getEvidRigiNotiWhoYear());
		info.setEvidRigiNotiYear(eForm.getEvidRigiNotiYear());
				
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EvidRigiNotiInfo.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/EvidRigiNotiInfo.do?method=detailEvidRigiInfo&eid="+info.getId(), true);
	}
	
	//证据登记保存通知书详细页面
	public ActionForward detailEvidRigiInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		EvidRigiNoti info = dao.findEvidRigiNotiById(request.getParameter("eid"));
		request.setAttribute("evidRigiNotiCode", info.getEvidRigiNotiCode());
		request.setAttribute("evidRigiNotiName", info.getEvidRigiNotiName());
		request.setAttribute("evidRigiNotiCount", info.getEvidRigiNotiCount());
		request.setAttribute("evidRigiNotiRemark", info.getEvidRigiNotiRemark());
		request.setAttribute("eInfo", info);
		return mapping.findForward("detail");
	}
	
	//删除证据登记保存通知书
	public ActionForward deleteEvidRigiNoti(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidRigiNoti info = dao.findEvidRigiNotiById(request.getParameter("eid"));
		String cid = info.getEvidRigiNotiCaseId();
		dao.delete(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("2");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EvidRigiNoti.delete").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/CaseInfo.do?method=detail&cid=" + cid, true);
	}
	
	
	public ActionForward docEvidRigiNotiInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		EvidRigiNoti info = dao.findEvidRigiNotiById(request.getParameter("eid"));
		request.setAttribute("evidRigiNotiCode", info.getEvidRigiNotiCode());
		request.setAttribute("evidRigiNotiName", info.getEvidRigiNotiName());
		request.setAttribute("evidRigiNotiCount", info.getEvidRigiNotiCount());
		request.setAttribute("evidRigiNotiRemark", info.getEvidRigiNotiRemark());
		request.setAttribute("eInfo", info);
		return mapping.findForward("doc");
	}

	
	
	/**
	 * 证据先行登记保存决定书
	 */
	
	//添加登记保存决定书
	public ActionForward toEvidDeciInfoAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("cid", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addEvidDeciInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		EvidDeciForm eForm = (EvidDeciForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidDeci info = new EvidDeci();
	    info.setEvidRigiDeciD(eForm.getEvidRigiDeciD());
	    info.setEvidRigiDeciDate(new Date());
	    info.setEvidRigiDeciDay(eForm.getEvidRigiDeciDay());
	    info.setEvidRigiDeciDnum(eForm.getEvidRigiDeciDnum());
	    info.setEvidRigiDeciInspDay(eForm.getEvidRigiDeciInspDay());
	    info.setEvidRigiDeciInspMonth(eForm.getEvidRigiDeciInspMonth());
	    info.setEvidRigiDeciNspYear(eForm.getEvidRigiDeciNspYear());
	    info.setEvidRigiDeciMonth(eForm.getEvidRigiDeciInspMonth());
	    info.setEvidRigiDeciNum(eForm.getEvidRigiDeciNum());
	    info.setEvidRigiDeciOgan(eForm.getEvidRigiDeciOgan());
	    info.setEvidRigiDeciOganDay(eForm.getEvidRigiDeciOganDay());
	    info.setEvidRigiDeciOganMonth(eForm.getEvidRigiDeciOganMonth());
	    info.setEvidRigiDeciOganYear(eForm.getEvidRigiDeciOganYear());
	    info.setEvidRigiDeciProv(eForm.getEvidRigiDeciProv());
	    info.setEvidRigiDeciTz(eForm.getEvidRigiDeciTz());
	    info.setEvidRigiDeciWho(eForm.getEvidRigiDeciWho());
	    info.setEvidRigiDeciWhoDay(eForm.getEvidRigiDeciWhoDay());
	    info.setEvidRigiDeciWhoMonth(eForm.getEvidRigiDeciWhoMonth());
	    info.setEvidRigiDeciWhoYear(eForm.getEvidRigiDeciWhoYear());
	    info.setEvidRigiDeciYear(eForm.getEvidRigiDeciYear());
	    info.setEvidRigiDeciId(eForm.getEvidRigiDeciId());
		dao.save(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EvidDeciInfo.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/EvidDeciInfo.do?method=detailEvidDeciInfo&eid="+info.getId(), true);
	}
	
	//修改证据先行登记保存决定书
	public ActionForward toEvidDeciInfoUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidDeci info = dao.findEvidDeciById(request.getParameter("eid"));
		request.setAttribute("eInfo", info);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateEvidDeciInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		EvidDeciForm eForm = (EvidDeciForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidDeci info = dao.findEvidDeciById(request.getParameter("id"));
		info.setEvidRigiDeciD(eForm.getEvidRigiDeciD());
	    info.setEvidRigiDeciDate(new Date());
	    info.setEvidRigiDeciDay(eForm.getEvidRigiDeciDay());
	    info.setEvidRigiDeciDnum(eForm.getEvidRigiDeciDnum());
	    info.setEvidRigiDeciInspDay(eForm.getEvidRigiDeciInspDay());
	    info.setEvidRigiDeciInspMonth(eForm.getEvidRigiDeciInspMonth());
	    info.setEvidRigiDeciNspYear(eForm.getEvidRigiDeciNspYear());
	    info.setEvidRigiDeciMonth(eForm.getEvidRigiDeciInspMonth());
	    info.setEvidRigiDeciNum(eForm.getEvidRigiDeciNum());
	    info.setEvidRigiDeciOgan(eForm.getEvidRigiDeciOgan());
	    info.setEvidRigiDeciOganDay(eForm.getEvidRigiDeciOganDay());
	    info.setEvidRigiDeciOganMonth(eForm.getEvidRigiDeciOganMonth());
	    info.setEvidRigiDeciOganYear(eForm.getEvidRigiDeciOganYear());
	    info.setEvidRigiDeciProv(eForm.getEvidRigiDeciProv());
	    info.setEvidRigiDeciTz(eForm.getEvidRigiDeciTz());
	    info.setEvidRigiDeciWho(eForm.getEvidRigiDeciWho());
	    info.setEvidRigiDeciWhoDay(eForm.getEvidRigiDeciWhoDay());
	    info.setEvidRigiDeciWhoMonth(eForm.getEvidRigiDeciWhoMonth());
	    info.setEvidRigiDeciWhoYear(eForm.getEvidRigiDeciWhoYear());
	    info.setEvidRigiDeciYear(eForm.getEvidRigiDeciYear());
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EvidDeciInfo.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/EvidDeciInfo.do?method=detailEvidDeciInfo&eid="+info.getId(), true);
	}
	
	//证据登记保存通知书详细页面
	public ActionForward detailEvidDeciInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		EvidDeci info = dao.findEvidDeciById(request.getParameter("eid"));
		request.setAttribute("eInfo", info);
		return mapping.findForward("detail");
	}
	
	//删除证据登记保存通知书
	public ActionForward deleteEvidDeci(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidDeci info = dao.findEvidDeciById(request.getParameter("eid"));
		String cid = info.getEvidRigiDeciId();
		dao.delete(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("2");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EvidDeciInfo.delete").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/CaseInfo.do?method=detail&cid=" + cid, true);
	}
	
	
	public ActionForward docEvidDeciInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		EvidDeci info = dao.findEvidDeciById(request.getParameter("eid"));
		request.setAttribute("eInfo", info);
		return mapping.findForward("doc");
	}

	
	/**
	 * 询问笔录
	 */
	//添加询问笔录
	public ActionForward toEvidenceInfoAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addEvidenceInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		EvidenceInfoForm eForm = (EvidenceInfoForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidenceInfo info = new EvidenceInfo();
		info.setEvidenceInfoCaseId(eForm.getEvidenceInfoCaseId());
		info.setEvidenceInfoBeginDate(eForm.getDateEvidenceInfoBeginDate());
		info.setEvidenceInfoEndDate(eForm.getDateEvidenceInfoEndDate());
		info.setEvidenceInfoAddress(eForm.getEvidenceInfoAddress());
		info.setEvidenceInfoQueryer(eForm.getEvidenceInfoQueryer());
		info.setEvidenceInfoRecorder(eForm.getEvidenceInfoRecorder());
		info.setEvidenceInfoQueried(eForm.getEvidenceInfoQueried());
		info.setEvidenceInfoSex(eForm.getEvidenceInfoSex());
		info.setEvidenceInfoNation(eForm.getEvidenceInfoNation());
		info.setEvidenceInfoAge(eForm.getEvidenceInfoAge());
		info.setEvidenceInfoNativePlace(eForm.getEvidenceInfoNativePlace());
		info.setEvidenceInfoEducationLevel(eForm.getEvidenceInfoEducationLevel());
		info.setEvidenceInfoDuty(eForm.getEvidenceInfoDuty());
		info.setEvidenceInfoHomeAddr(eForm.getEvidenceInfoHomeAddr());
		info.setEvidenceInfoPhone(eForm.getEvidenceInfoPhone());
		info.setEvidenceInfoRecorContent(eForm.getEvidenceInfoRecorContent());
		info.setEvidenceInfoFileUrl(eForm.getEvidenceInfoFileUrl());
		dao.save(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EvidenceInfo.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/EvidenceInfo.do?method=detailEvidenceInfo&eid=" + info.getEvidenceInfoId(), true);
	}
	
	//修改询问笔录
	public ActionForward toEvidenceInfoUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidenceInfo info = dao.findEvidenceInfoById(request.getParameter("eid"));
		request.setAttribute("eInfo", info);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateEvidenceInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		EvidenceInfoForm eForm = (EvidenceInfoForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidenceInfo info = dao.findEvidenceInfoById(request.getParameter("eid"));
		info.setEvidenceInfoBeginDate(eForm.getDateEvidenceInfoBeginDate());
		info.setEvidenceInfoEndDate(eForm.getDateEvidenceInfoEndDate());
		info.setEvidenceInfoAddress(eForm.getEvidenceInfoAddress());
		info.setEvidenceInfoQueryer(eForm.getEvidenceInfoQueryer());
		info.setEvidenceInfoRecorder(eForm.getEvidenceInfoRecorder());
		info.setEvidenceInfoQueried(eForm.getEvidenceInfoQueried());
		info.setEvidenceInfoSex(eForm.getEvidenceInfoSex());
		info.setEvidenceInfoNation(eForm.getEvidenceInfoNation());
		info.setEvidenceInfoAge(eForm.getEvidenceInfoAge());
		info.setEvidenceInfoNativePlace(eForm.getEvidenceInfoNativePlace());
		info.setEvidenceInfoEducationLevel(eForm.getEvidenceInfoEducationLevel());
		info.setEvidenceInfoDuty(eForm.getEvidenceInfoDuty());
		info.setEvidenceInfoHomeAddr(eForm.getEvidenceInfoHomeAddr());
		info.setEvidenceInfoPhone(eForm.getEvidenceInfoPhone());
		info.setEvidenceInfoRecorContent(eForm.getEvidenceInfoRecorContent());
		info.setEvidenceInfoFileUrl(eForm.getEvidenceInfoFileUrl());
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EvidenceInfo.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/EvidenceInfo.do?method=detailEvidenceInfo&eid=" + info.getEvidenceInfoId(), true);
	}
	
	//询问笔录详细页面
	public ActionForward detailEvidenceInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		EvidenceInfo info = dao.findEvidenceInfoById(request.getParameter("eid"));
		request.setAttribute("eInfo", info);
		return mapping.findForward("detail");
	}
	
	//删除询问笔录
	public ActionForward deleteEvidenceInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidenceInfo info = dao.findEvidenceInfoById(request.getParameter("eid"));
		String cid = info.getEvidenceInfoCaseId();
		dao.delete(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("2");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EvidenceInfo.delete").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/CaseInfo.do?method=detail&cid=" + cid, true);
	}
	
	//上传证据文件
	public ActionForward upload(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		try {
			HashMap map = Upload.upload(request, "evidence", ".doc;.xls;.ppt;.rar;.zip;.jpg;.gif");
			if(map.containsKey("fileName")){
				request.setAttribute("fileName", (String)map.get("fileName"));
			}else{
				request.setAttribute("error", "error");
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		return mapping.findForward("upload");
	}
	
	
	/**
	 * 案件讨论记录
	 */
	//添加案件讨论记录
	public ActionForward toDisscussRecordAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("cInfo", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addDiscussRecord(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DiscussRecordForm dForm = (DiscussRecordForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DiscussRecord info = new DiscussRecord();
		info.setDiscussRecordAccord(dForm.getDiscussRecordAccord());
		info.setDiscussRecordCasedisc(dForm.getDiscussRecordCasedisc());
		info.setDiscussRecordCaseId(dForm.getDiscussRecordCaseId());
		info.setDiscussRecordDate(new Date());
		info.setDiscussRecordDay(dForm.getDiscussRecordDay());
		info.setDiscussRecordDirDuty(dForm.getDiscussRecordDirDuty());
		info.setDiscussRecordDirect(dForm.getDiscussRecordDirect());
		info.setDiscussRecordDisc(dForm.getDiscussRecordDisc());
		info.setDiscussRecordEvid(dForm.getDiscussRecordEvid());
		info.setDiscussRecordHour(dForm.getDiscussRecordHour());
		info.setDiscussRecordLawtrue(dForm.getDiscussRecordLawtrue());
		info.setDiscussRecordMin(dForm.getDiscussRecordMin());
		info.setDiscussRecordMonth(dForm.getDiscussRecordMonth());
		info.setDiscussRecordNum(dForm.getDiscussRecordNum());
		info.setDiscussRecordPlace(dForm.getDiscussRecordPlace());
		info.setDiscussRecordRecorder(dForm.getDiscussRecordRecorder());
		info.setDiscussRecordToHour(dForm.getDiscussRecordToHour());
		info.setDiscussRecordToMin(dForm.getDiscussRecordToMin());
		info.setDiscussRecordWho(dForm.getDiscussRecordWho());
		info.setDiscussRecordYear(dForm.getDiscussRecordYear());
		dao.save(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DiscussRecord.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DiscussRecord.do?method=detailDiscussRecord&did=" + info.getId(), true);
	}
	
	//修改案件讨论记录
	public ActionForward toDiscussRecordUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);

		DiscussRecord info = dao.findDiscussRecordById(request.getParameter("did"));
		request.setAttribute("cInfo", dao.findById(info.getDiscussRecordCaseId()));
		request.setAttribute("dInfo", info);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateDiscussRecord(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DiscussRecordForm dForm = (DiscussRecordForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DiscussRecord info = dao.findDiscussRecordById(dForm.getId());
		info.setDiscussRecordAccord(dForm.getDiscussRecordAccord());
		info.setDiscussRecordCasedisc(dForm.getDiscussRecordCasedisc());
		info.setDiscussRecordDay(dForm.getDiscussRecordDay());
		info.setDiscussRecordDirDuty(dForm.getDiscussRecordDirDuty());
		info.setDiscussRecordDirect(dForm.getDiscussRecordDirect());
		info.setDiscussRecordDisc(dForm.getDiscussRecordDisc());
		info.setDiscussRecordEvid(dForm.getDiscussRecordEvid());
		info.setDiscussRecordHour(dForm.getDiscussRecordHour());
		info.setDiscussRecordLawtrue(dForm.getDiscussRecordLawtrue());
		info.setDiscussRecordMin(dForm.getDiscussRecordMin());
		info.setDiscussRecordMonth(dForm.getDiscussRecordMonth());
		info.setDiscussRecordNum(dForm.getDiscussRecordNum());
		info.setDiscussRecordPlace(dForm.getDiscussRecordPlace());
		info.setDiscussRecordRecorder(dForm.getDiscussRecordRecorder());
		info.setDiscussRecordToHour(dForm.getDiscussRecordToHour());
		info.setDiscussRecordToMin(dForm.getDiscussRecordToMin());
		info.setDiscussRecordWho(dForm.getDiscussRecordWho());
		info.setDiscussRecordYear(dForm.getDiscussRecordYear());
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DiscussRecord.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DiscussRecord.do?method=detailDiscussRecord&did=" + info.getId(), true);
	}
	
	//案件讨论记录详细页面
	public ActionForward detailDiscussRecord(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DiscussRecord info = dao.findDiscussRecordById(request.getParameter("did"));
		request.setAttribute("cInfo", dao.findById(info.getDiscussRecordCaseId()));
		request.setAttribute("dInfo", info);
		return mapping.findForward("detail");
	}
	
	//案件讨论记录下载
	public ActionForward docDiscussRecord(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DiscussRecord info = dao.findDiscussRecordById(request.getParameter("did"));
		request.setAttribute("cInfo", dao.findById(info.getDiscussRecordCaseId()));
		request.setAttribute("dInfo", info);
		return mapping.findForward("doc");
	}
	
	//删除案件讨论记录
	public ActionForward deleteDiscussRecord(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DiscussRecord info = dao.findDiscussRecordById(request.getParameter("did"));
		String cid = info.getDiscussRecordCaseId();
		dao.delete(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("2");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DiscussRecord.delete").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/CaseInfo.do?method=detail&cid=" + cid, true);
	}

	
	
	/**
	 * 案件转移书
	 */
	
	//添加案件转移书
	public ActionForward toCaseChangeInspAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("caseId", request.getParameter("cid"));
		request.setAttribute("caseInfo", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addCaseChangeInsp(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseChangeInspForm cForm = (CaseChangeInspForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		CaseChangeInsp info = new CaseChangeInsp();
		StringBuffer caseChangeInspStrBuffer = new StringBuffer();
		String [] caseChangeInspMater = request.getParameterValues("caseChangeInspMater");
		for(int i=0;i<caseChangeInspMater.length; i++){
			caseChangeInspStrBuffer.append(";"+caseChangeInspMater[i]);
		}
	    info.setCaseChangeInspCaseId(cForm.getCaseChangeInspCaseId());
	    info.setCaseChangeInspDate(new Date());
	    info.setCaseChangeInspDh(cForm.getCaseChangeInspDh());
	    info.setCaseChangeInspMater(caseChangeInspStrBuffer.substring(1));
	    info.setCaseChangeInspOgan(cForm.getCaseChangeInspOgan());
	    info.setCaseChangeInspProviName(cForm.getCaseChangeInspProviName());
	    info.setCaseChangeInspZ(cForm.getCaseChangeInspZ());
		PersionFile persionFile = SystemSession.getSupUserInfo(request);
		CaseInfo cinfo = dao.findById(request.getParameter("caseChangeInspCaseId"));
		cinfo.setPersionFile(persionFile);
		cinfo.setCaseInfoCasestate("f");
		dao.save(info);
		dao.merge(cinfo);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "CaseChangeInsp.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/CaseChangeInsp.do?method=detailCaseChangeInsp&cid="+info.getId(), true);
	}
	
	//修改案件转移书
	public ActionForward toCaseChangeInspUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		CaseChangeInsp info = dao.findCaseChangeInspById(request.getParameter("cid"));
		request.setAttribute("caseInfo", dao.findById(info.getCaseChangeInspCaseId()));
		request.setAttribute("cInfo", info);
		request.setAttribute("caseChangeInspMater", info.getCaseChangeInspMater());
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateCaseChangeInsp(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseChangeInspForm cForm = (CaseChangeInspForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		CaseChangeInsp info = dao.findCaseChangeInspById(cForm.getId());
		StringBuffer caseChangeInspStrBuffer = new StringBuffer();
		String [] caseChangeInspMater = request.getParameterValues("caseChangeInspMater");
		for(int i=0;i<caseChangeInspMater.length; i++){
			caseChangeInspStrBuffer.append(";"+caseChangeInspMater[i]);
		}
	    info.setCaseChangeInspDh(cForm.getCaseChangeInspDh());
	    info.setCaseChangeInspMater(caseChangeInspStrBuffer.substring(1));
	    info.setCaseChangeInspOgan(cForm.getCaseChangeInspOgan());
	    info.setCaseChangeInspProviName(cForm.getCaseChangeInspProviName());
	    info.setCaseChangeInspZ(cForm.getCaseChangeInspZ());
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "CaseChangeInsp.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/CaseChangeInsp.do?method=detailCaseChangeInsp&cid="+info.getId(), true);
	}
	
	//案件转移详细页面
	public ActionForward detailCaseChangeInsp(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		CaseChangeInsp info = dao.findCaseChangeInspById(request.getParameter("cid"));
		request.setAttribute("caseInfo", dao.findById(info.getCaseChangeInspCaseId()));
		request.setAttribute("cInfo", info);
		request.setAttribute("caseChangeInspMater", info.getCaseChangeInspMater());
		return mapping.findForward("detail");
	}
	
/*	//删除案件转移
	public ActionForward deleteEvidRigiNoti(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EvidRigiNoti info = dao.findEvidRigiNotiById(request.getParameter("eid"));
		String cid = info.getEvidRigiNotiCaseId();
		dao.delete(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("2");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EvidRigiNoti.delete").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/CaseInfo.do?method=detail&cid=" + cid, true);
	}
	
	*/
	public ActionForward docCaseChangeInsp(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		CaseChangeInsp info = dao.findCaseChangeInspById(request.getParameter("cid"));
		request.setAttribute("caseInfo", dao.findById(info.getCaseChangeInspCaseId()));
		request.setAttribute("cInfo", info);
		request.setAttribute("caseChangeInspMater", info.getCaseChangeInspMater());
		return mapping.findForward("doc");
	}
	
	/**
	 * 强制执行书
	 */
	
	//添加强制执行书
	public ActionForward toEnforceDoAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("caseInfo", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addEnforceDo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		EnforceDoForm eForm = (EnforceDoForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EnforceDo info = new EnforceDo();
		StringBuffer enforceDoDeplSthBuffer = new StringBuffer();
		String [] enforceDoDeplSth = request.getParameterValues("enforceDoDeplSth");
		for(int i=0;i<enforceDoDeplSth.length; i++){
			enforceDoDeplSthBuffer.append(";"+enforceDoDeplSth[i]);
		}
		info.setEnforceDoAddress(eForm.getEnforceDoAddress());
		info.setEnforceDoApplyer(eForm.getEnforceDoApplyer());
		info.setEnforceDoCaseId(eForm.getEnforceDoCaseId());
		info.setEnforceDoCopy(eForm.getEnforceDoCopy());
		info.setEnforceDoData(eForm.getEnforceDoData());
		info.setEnforceDoDate(new Date());
		info.setEnforceDoDeDay(eForm.getEnforceDoDeDay());
		info.setEnforceDoDeMonth(eForm.getEnforceDoDeMonth());
		info.setEnforceDoDeNum(eForm.getEnforceDoDeNum());
		info.setEnforceDoDeplD(eForm.getEnforceDoDeplD());
		info.setEnforceDoDeplM(eForm.getEnforceDoDeplM());
		info.setEnforceDoDeplSth(enforceDoDeplSthBuffer.substring(1));
		info.setEnforceDoDeplY(eForm.getEnforceDoDeplY());
		info.setEnforceDoDeYewr(eForm.getEnforceDoDeYewr());
		info.setEnforceDoDh(eForm.getEnforceDoDh());
		info.setEnforceDoDuty(eForm.getEnforceDoDuty());
		info.setEnforceDoLawName(eForm.getEnforceDoLawName());
		info.setEnforceDoLawPer(eForm.getEnforceDoLawPer());
		info.setEnforceDoNum(eForm.getEnforceDoNum());
		info.setEnforceDoProvName(eForm.getEnforceDoProvName());
		info.setEnforceDoSz(eForm.getEnforceDoSz());
		info.setEnforceDoTel(eForm.getEnforceDoTel());
		info.setEnforceDoWho(eForm.getEnforceDoWho());
		info.setEnforceDoWhoAdd(eForm.getEnforceDoWhoAdd());
		info.setEnforceDoWhoDuty(eForm.getEnforceDoWhoDuty());
		info.setEnforceDoWhoLawPer(eForm.getEnforceDoWhoLawPer());
		info.setEnforceDoWhoTel(eForm.getEnforceDoWhoTel());
		info.setEnforceDoOgan(eForm.getEnforceDoOgan());
		dao.save(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EnforceDo.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/EnforceDo.do?method=detailEnforceDo&eid="+info.getId(), true);
	}
	
	//修改强制执行书
	public ActionForward toEnforceDoUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EnforceDo info = dao.findEnforceDoById(request.getParameter("eid"));
		request.setAttribute("caseInfo", dao.findById(info.getEnforceDoCaseId()));
		request.setAttribute("eInfo", info);
		request.setAttribute("enforceDoDeplSth", info.getEnforceDoDeplSth());
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateEnforceDo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		EnforceDoForm eForm = (EnforceDoForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		EnforceDo info = dao.findEnforceDoById(eForm.getId());;
		StringBuffer enforceDoDeplSthBuffer = new StringBuffer();
		String [] enforceDoDeplSth = request.getParameterValues("enforceDoDeplSth");
		for(int i=0;i<enforceDoDeplSth.length; i++){
			enforceDoDeplSthBuffer.append(";"+enforceDoDeplSth[i]);
		}
		info.setEnforceDoAddress(eForm.getEnforceDoAddress());
		info.setEnforceDoApplyer(eForm.getEnforceDoApplyer());
		info.setEnforceDoCopy(eForm.getEnforceDoCopy());
		info.setEnforceDoData(eForm.getEnforceDoData());
		info.setEnforceDoDeDay(eForm.getEnforceDoDeDay());
		info.setEnforceDoDeMonth(eForm.getEnforceDoDeMonth());
		info.setEnforceDoDeNum(eForm.getEnforceDoDeNum());
		info.setEnforceDoDeplD(eForm.getEnforceDoDeplD());
		info.setEnforceDoDeplM(eForm.getEnforceDoDeplM());
		info.setEnforceDoDeplSth(enforceDoDeplSthBuffer.substring(1));
		info.setEnforceDoDeplY(eForm.getEnforceDoDeplY());
		info.setEnforceDoDeYewr(eForm.getEnforceDoDeYewr());
		info.setEnforceDoDh(eForm.getEnforceDoDh());
		info.setEnforceDoDuty(eForm.getEnforceDoDuty());
		info.setEnforceDoLawName(eForm.getEnforceDoLawName());
		info.setEnforceDoLawPer(eForm.getEnforceDoLawPer());
		info.setEnforceDoNum(eForm.getEnforceDoNum());
		info.setEnforceDoProvName(eForm.getEnforceDoProvName());
		info.setEnforceDoSz(eForm.getEnforceDoSz());
		info.setEnforceDoTel(eForm.getEnforceDoTel());
		info.setEnforceDoWho(eForm.getEnforceDoWho());
		info.setEnforceDoWhoAdd(eForm.getEnforceDoWhoAdd());
		info.setEnforceDoWhoDuty(eForm.getEnforceDoWhoDuty());
		info.setEnforceDoWhoLawPer(eForm.getEnforceDoWhoLawPer());
		info.setEnforceDoWhoTel(eForm.getEnforceDoWhoTel());
		info.setEnforceDoOgan(eForm.getEnforceDoOgan());
	
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "EnforceDo.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/EnforceDo.do?method=detailEnforceDo&eid="+info.getId(), true);
	}
	
	//案件转移详细页面
	public ActionForward detailEnforceDo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		EnforceDo info = dao.findEnforceDoById(request.getParameter("eid"));
		request.setAttribute("caseInfo", dao.findById(info.getEnforceDoCaseId()));
		request.setAttribute("eInfo", info);
		request.setAttribute("enforceDoDeplSth", info.getEnforceDoDeplSth());
		return mapping.findForward("detail");
	}
	

	public ActionForward docEnforceDo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		System.out.println(request.getParameter("eid"));
		EnforceDo info = dao.findEnforceDoById(request.getParameter("eid"));
		request.setAttribute("caseInfo", dao.findById(info.getEnforceDoCaseId()));
		request.setAttribute("eInfo", info);
		request.setAttribute("enforceDoDeplSth", info.getEnforceDoDeplSth());
		return mapping.findForward("doc");
	}
	
	
	
	
	
	
	
	
	
	/**
	 *处理申请(审批)模块
	 */
	//处理申请 添加处理申请基本信息 监察员
	public ActionForward toDisposalConsiderationsAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addDisposalConsiderations(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalConsiderationsForm dForm = (DisposalConsiderationsForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalConsiderations dc = new DisposalConsiderations();
		dc.setDisposalConsCaseId(dForm.getDisposalConsCaseId());
		dc.setDisposalConsInspectorId(SystemSession.getSupUserId(request));
		dc.setDisposalConsDealOption(dForm.getDisposalConsDealOption());
		dc.setDisposalConsInspectorDate(new Date());
		
		//将立案状态修改为处理审批
		CaseInfo info = dao.findById(dForm.getDisposalConsCaseId());
		info.setCaseInfoCasestate("3");
		
		dao.save(dc);
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("8");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "addDisposalConsiderations").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()).replace("$record", info.getCaseInfoCode()));
		logDao.save(s);
		return new ActionForward("/DisposalConsiderations.do?method=detailDisposalConsiderations&did=" + dc.getDisposalConsId(), true);
	}
	
	//修改处理申请 监察员
	public ActionForward toDisposalConsiderationsUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalConsiderations dc = dao.findDisposalConsiderationsById(request.getParameter("did"));
		if(dc.getDisposalConsInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(dc.getDisposalConsInspectorId());
			request.setAttribute("p1", p1);
		}
		request.setAttribute("dc", dc);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateDisposalConsiderations(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalConsiderationsForm dForm = (DisposalConsiderationsForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalConsiderations dc = dao.findDisposalConsiderationsById(request.getParameter("did"));
		dc.setDisposalConsDealOption(dForm.getDisposalConsDealOption());
		dao.merge(dc);
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/DisposalConsiderations.do?method=detailDisposalConsiderations&did=" + dc.getDisposalConsId(), true);
	}
	
	//审批处理申请 领导
	public ActionForward toDisposalConsiderationsApply(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalConsiderations dc = dao.findDisposalConsiderationsById(request.getParameter("did"));
		if(dc.getDisposalConsInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(dc.getDisposalConsInspectorId());
			request.setAttribute("p1", p1);
		}
		request.setAttribute("dc", dc);
		return mapping.findForward("toApply");
	}
	
	public ActionForward applyDisposalConsiderations(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalConsiderationsForm dForm = (DisposalConsiderationsForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalConsiderations dc = dao.findDisposalConsiderationsById(request.getParameter("did"));
		dc.setDisposalConsLeadOption(dForm.getDisposalConsLeadOption());
		dc.setDisposalConsLeadId(SystemSession.getSupUserId(request));
		dc.setDisposalConsLeadDate(new Date());
		CaseInfo info = dao.findById(dc.getDisposalConsCaseId());
		info.setCaseInfoCasestate("4");
		dao.merge(dc);
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("9");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "applyDisposalConsiderations").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DisposalConsiderations.do?method=detailDisposalConsiderations&did=" + dc.getDisposalConsId(), true);
	}
	
	//处理申请详细页面
	public ActionForward detailDisposalConsiderations(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalConsiderations dc = dao.findDisposalConsiderationsById(request.getParameter("did"));
		if(dc.getDisposalConsInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(dc.getDisposalConsInspectorId());
			request.setAttribute("p1", p1);
		}
		if(dc.getDisposalConsLeadId() != null){
			PersionFile p2 = dao.findPersionFileById(dc.getDisposalConsLeadId());
			request.setAttribute("p2", p2);
		}
		request.setAttribute("dc", dc);
		return mapping.findForward("detail");
	}
	
	//处理申请表下载
	public ActionForward docDisposalConsiderations(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalConsiderations dc = dao.findDisposalConsiderationsById(request.getParameter("did"));
		request.setAttribute("cInfo", dao.findById(dc.getDisposalConsCaseId()));
		if(dc.getDisposalConsInspectorId() != null){
			PersionFile p1 = dao.findPersionFileById(dc.getDisposalConsInspectorId());
			request.setAttribute("p1", p1);
		}
		if(dc.getDisposalConsLeadId() != null){
			PersionFile p2 = dao.findPersionFileById(dc.getDisposalConsLeadId());
			request.setAttribute("p2", p2);
		}
		request.setAttribute("dc", dc);
		return mapping.findForward("doc");
	}
	
	/**
	 * 整改指令书
	 */
	
	//添加整改指令书
	public ActionForward toDisposalRectificationAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("cInfo", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addDisposalRectification(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalRectificationForm dForm = (DisposalRectificationForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalRectification dr = new DisposalRectification();
		dr.setDisposalRectCaseId(dForm.getDisposalRectCaseId());
		dr.setDisposalRectProvName(dForm.getDisposalRectProvName());
		dr.setDisposalRectNspNum(dForm.getDisposalRectNspNum());
		dr.setDisposalRectUnitName(dForm.getDisposalRectUnitName());
		dr.setDisposalRectBreackLaw(dForm.getDisposalRectBreackLaw());
		dr.setDisposalRectHaveQuestion(dForm.getDisposalRectHaveQuestion());
		dr.setDisposalRectAccordLaw(dForm.getDisposalRectAccordLaw());
		dr.setDisposalRectDecision(dForm.getDisposalRectDecision());
		dr.setDisposalRectYear(dForm.getDisposalRectYear());
		dr.setDisposalRectMonth(dForm.getDisposalRectMonth());
		dr.setDisposalRectDay(dForm.getDisposalRectDay());
		dr.setDisposalRectSendYear(dForm.getDisposalRectSendYear());
		dr.setDisposalRectSendMonth(dForm.getDisposalRectSendMonth());
		dr.setDisposalRectSendDay(dForm.getDisposalRectSendDay());
		dao.save(dr);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DisposalRectification.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DisposalRectification.do?method=detailDisposalRectification&did=" + dr.getDisposalRectId(), true);
	}
	
	//修改整改指令书
	public ActionForward toDisposalRectificationUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalRectification dr = dao.findDisposalRectificationById(request.getParameter("did"));
		request.setAttribute("dr", dr);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateDisposalRectification(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalRectificationForm dForm = (DisposalRectificationForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalRectification dr = dao.findDisposalRectificationById(request.getParameter("did"));
		dr.setDisposalRectProvName(dForm.getDisposalRectProvName());
		dr.setDisposalRectNspNum(dForm.getDisposalRectNspNum());
		dr.setDisposalRectUnitName(dForm.getDisposalRectUnitName());
		dr.setDisposalRectBreackLaw(dForm.getDisposalRectBreackLaw());
		dr.setDisposalRectHaveQuestion(dForm.getDisposalRectHaveQuestion());
		dr.setDisposalRectAccordLaw(dForm.getDisposalRectAccordLaw());
		dr.setDisposalRectDecision(dForm.getDisposalRectDecision());
		dr.setDisposalRectYear(dForm.getDisposalRectYear());
		dr.setDisposalRectMonth(dForm.getDisposalRectMonth());
		dr.setDisposalRectDay(dForm.getDisposalRectDay());
		dr.setDisposalRectSendYear(dForm.getDisposalRectSendYear());
		dr.setDisposalRectSendMonth(dForm.getDisposalRectSendMonth());
		dr.setDisposalRectSendDay(dForm.getDisposalRectSendDay());
		dao.merge(dr);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DisposalRectification.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DisposalRectification.do?method=detailDisposalRectification&did=" + dr.getDisposalRectId(), true);
	}
	
	//整改指令书详细页面
	public ActionForward detailDisposalRectification(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalRectification dr = dao.findDisposalRectificationById(request.getParameter("did"));
		request.setAttribute("dr", dr);
		return mapping.findForward("detail");
	}

	public ActionForward docDisposalRectification(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalRectification dr = dao.findDisposalRectificationById(request.getParameter("did"));
		request.setAttribute("dr", dr);
		return mapping.findForward("doc");
	}
	
	/**
	 * 行政处罚告知书
	 */
	
	//添加行政处罚告知书
	public ActionForward toDisposalNoticeAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("cInfo", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addDisposalNotice(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalNoticeForm dForm = (DisposalNoticeForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalNotice dn = new DisposalNotice();
		dn.setDisposalNoticeCaseId(dForm.getDisposalNoticeCaseId());
		dn.setDisposalNoticeProvName(dForm.getDisposalNoticeProvName());
		dn.setDisposalNoticeNspNum(dForm.getDisposalNoticeNspNum());
		dn.setDisposalNoticeUnitName(dForm.getDisposalNoticeUnitName());
		dn.setDisposalNoticeBreaklawYear(dForm.getDisposalNoticeBreaklawYear());
		dn.setDisposalNoticeBreaklawMonth(dForm.getDisposalNoticeBreaklawMonth());
		dn.setDisposalNoticeBreaklawDay(dForm.getDisposalNoticeBreaklawDay());
		dn.setDisposalNoticeBreaklawDoing(dForm.getDisposalNoticeBreaklawDoing());
		dn.setDisposalNoticeBreaklawRule(dForm.getDisposalNoticeBreaklawRule());
		dn.setDisposalNoticePunnisment(dForm.getDisposalNoticePunnisment());
		dn.setDisposalNoticeAddress(dForm.getDisposalNoticeAddress());
		dn.setDisposalNoticePhone(dForm.getDisposalNoticePhone());
		dn.setDisposalNoticeDepart(dForm.getDisposalNoticeDepart());
		dn.setDisposalNoticePostcode(dForm.getDisposalNoticePostcode());
		dn.setDisposalNoticeSendYear(dForm.getDisposalNoticeSendYear());
		dn.setDisposalNoticeSendMonth(dForm.getDisposalNoticeSendMonth());
		dn.setDisposalNoticeSendDay(dForm.getDisposalNoticeSendDay());
		dn.setDisposalNoticeAccord(dForm.getDisposalNoticeAccord());
		dn.setDisposalNoticeOgan(dForm.getDisposalNoticeOgan());
		dao.save(dn);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DisposalNotice.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DisposalNotice.do?method=detailDisposalNotice&did=" + dn.getDisposalNoticeId(), true);
	}
	
	//修改行政处罚告知书
	public ActionForward toDisposalNoticeUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalNotice dn = dao.findDisposalNoticeById(request.getParameter("did"));
		request.setAttribute("dn", dn);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateDisposalNotice(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalNoticeForm dForm = (DisposalNoticeForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalNotice dn = dao.findDisposalNoticeById(request.getParameter("did"));
		dn.setDisposalNoticeProvName(dForm.getDisposalNoticeProvName());
		dn.setDisposalNoticeNspNum(dForm.getDisposalNoticeNspNum());
		dn.setDisposalNoticeUnitName(dForm.getDisposalNoticeUnitName());
		dn.setDisposalNoticeBreaklawYear(dForm.getDisposalNoticeBreaklawYear());
		dn.setDisposalNoticeBreaklawMonth(dForm.getDisposalNoticeBreaklawMonth());
		dn.setDisposalNoticeBreaklawDay(dForm.getDisposalNoticeBreaklawDay());
		dn.setDisposalNoticeBreaklawDoing(dForm.getDisposalNoticeBreaklawDoing());
		dn.setDisposalNoticeBreaklawRule(dForm.getDisposalNoticeBreaklawRule());
		dn.setDisposalNoticePunnisment(dForm.getDisposalNoticePunnisment());
		dn.setDisposalNoticeAddress(dForm.getDisposalNoticeAddress());
		dn.setDisposalNoticePhone(dForm.getDisposalNoticePhone());
		dn.setDisposalNoticeDepart(dForm.getDisposalNoticeDepart());
		dn.setDisposalNoticePostcode(dForm.getDisposalNoticePostcode());
		dn.setDisposalNoticeSendYear(dForm.getDisposalNoticeSendYear());
		dn.setDisposalNoticeSendMonth(dForm.getDisposalNoticeSendMonth());
		dn.setDisposalNoticeSendDay(dForm.getDisposalNoticeSendDay());
		dn.setDisposalNoticeAccord(dForm.getDisposalNoticeAccord());
		dn.setDisposalNoticeOgan(dForm.getDisposalNoticeOgan());
		dao.merge(dn);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DisposalNotice.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DisposalNotice.do?method=detailDisposalNotice&did=" + dn.getDisposalNoticeId(), true);
	}
	
	//行政处罚告知书详细页面
	public ActionForward detailDisposalNotice(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalNotice dn = dao.findDisposalNoticeById(request.getParameter("did"));
		request.setAttribute("dn", dn);
		return mapping.findForward("detail");
	}

	public ActionForward docDisposalNotice(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalNotice dn = dao.findDisposalNoticeById(request.getParameter("did"));
		request.setAttribute("dn", dn);
		return mapping.findForward("doc");
	}
	public ActionForward docDisposalNoticeTz(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalNotice dn = dao.findDisposalNoticeById(request.getParameter("did"));
		request.setAttribute("dn", dn);
		return mapping.findForward("doctz");
	}
	
	/**
	 * 行政处罚决定书
	 */
	
	//添加行政处罚决定书
	public ActionForward toDisposalDecisionAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("cInfo", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addDisposalDecision(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalDecisionForm dForm = (DisposalDecisionForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalDecision dd = new DisposalDecision();
		dd.setDispDeciCaseId(dForm.getDispDeciCaseId());
		dd.setDispDeciProvName(dForm.getDispDeciProvName());
		dd.setDispDeciNspNum(dForm.getDispDeciNspNum());
		dd.setDispDeciUnitName(dForm.getDispDeciUnitName());
		dd.setDispDeciCaseOrigin(dForm.getDispDeciCaseOrigin());
		dd.setDispDeciTrueEvidence(dForm.getDispDeciTrueEvidence());
		dd.setDispDeciBreackLaw(dForm.getDispDeciBreackLaw());
		dd.setDispDeciAccordLaw(dForm.getDispDeciAccordLaw());
		dd.setDispDeciDecision(dForm.getDispDeciDecision());
		dd.setDispDeciSendDate(dForm.getDispDeciSendDate());
		dd.setDispDeciSendMonth(dForm.getDispDeciSendMonth());
		dd.setDispDeciSendDay(dForm.getDispDeciSendDay());
		dao.save(dd);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DisposalDecision.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DisposalDecision.do?method=detailDisposalDecision&did=" + dd.getDispDeciId(), true);
	}
	
	//修改行政处罚决定书
	public ActionForward toDisposalDecisionUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalDecision dd = dao.findDisposalDecisionById(request.getParameter("did"));
		request.setAttribute("dd", dd);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateDisposalDecision(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalDecisionForm dForm = (DisposalDecisionForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalDecision dd = dao.findDisposalDecisionById(request.getParameter("did"));
		dd.setDispDeciProvName(dForm.getDispDeciProvName());
		dd.setDispDeciNspNum(dForm.getDispDeciNspNum());
		dd.setDispDeciUnitName(dForm.getDispDeciUnitName());
		dd.setDispDeciCaseOrigin(dForm.getDispDeciCaseOrigin());
		dd.setDispDeciTrueEvidence(dForm.getDispDeciTrueEvidence());
		dd.setDispDeciBreackLaw(dForm.getDispDeciBreackLaw());
		dd.setDispDeciAccordLaw(dForm.getDispDeciAccordLaw());
		dd.setDispDeciDecision(dForm.getDispDeciDecision());
		dd.setDispDeciSendDate(dForm.getDispDeciSendDate());
		dd.setDispDeciSendMonth(dForm.getDispDeciSendMonth());
		dd.setDispDeciSendDay(dForm.getDispDeciSendDay());
		dao.merge(dd);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DisposalDecision.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DisposalDecision.do?method=detailDisposalDecision&did=" + dd.getDispDeciId(), true);
	}
	
	//行政处罚决定书详细页面
	public ActionForward detailDisposalDecision(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalDecision dd = dao.findDisposalDecisionById(request.getParameter("did"));
		request.setAttribute("dd", dd);
		return mapping.findForward("detail");
	}

	public ActionForward docDisposalDecision(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalDecision dd = dao.findDisposalDecisionById(request.getParameter("did"));
		request.setAttribute("dd", dd);
		return mapping.findForward("doc");
	}
	
	public ActionForward docDisposalDecisionCf(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalDecision dd = dao.findDisposalDecisionById(request.getParameter("did"));
		request.setAttribute("dd", dd);
		return mapping.findForward("docCf");
	}
	/**
	 *处理申请(审批)模块
	 */
	//处理申请 添加处理申请基本信息 监察员
	public ActionForward toDisposalTrackAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addDisposalTrack(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalTrackForm dForm = (DisposalTrackForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalTrack dt = new DisposalTrack();
		dt.setDisposalTrackCaseId(dForm.getDisposalTrackCaseId());
		dt.setDisposalTrackPerformWay(dForm.getDisposalTrackPerformWay());
		dt.setDisposalTrackWay(dForm.getDisposalTrackWay());
		//如果是行政处罚
		if("2".equals(dt.getDisposalTrackWay())){
			dt.setDisposalTrackType(dForm.getDisposalTrackType());
			//如果是罚款
			if("1".equals(dt.getDisposalTrackType())){
				dt.setDisposalTrackMoney(dForm.getDisposalTrackMoney());
			}else{
				dt.setDisposalTrackMoney("0");
			}
		}else{
			dt.setDisposalTrackType(null);
			dt.setDisposalTrackMoney("0");
		}
		dao.save(dt);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DisposalTrack.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DisposalTrack.do?method=detailDisposalTrack&did=" + dt.getDisposalTrackId(), true);
	}
	
	//修改处理申请 监察员
	public ActionForward toDisposalTrackUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalTrack dt = dao.findDisposalTrackById(request.getParameter("did"));
		request.setAttribute("dt", dt);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateDisposalTrack(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		DisposalTrackForm dForm = (DisposalTrackForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		DisposalTrack dt = dao.findDisposalTrackById(request.getParameter("did"));
		dt.setDisposalTrackPerformWay(dForm.getDisposalTrackPerformWay());
		dt.setDisposalTrackWay(dForm.getDisposalTrackWay());
		//如果是行政处罚
		if("2".equals(dt.getDisposalTrackWay())){
			dt.setDisposalTrackType(dForm.getDisposalTrackType());
			//如果是罚款
			if("1".equals(dt.getDisposalTrackType())){
				dt.setDisposalTrackMoney(dForm.getDisposalTrackMoney());
			}else{
				dt.setDisposalTrackMoney("0");
			}
		}else{
			dt.setDisposalTrackType(null);
			dt.setDisposalTrackMoney("0");
		}
		dao.merge(dt);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "DisposalTrack.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/DisposalTrack.do?method=detailDisposalTrack&did=" + dt.getDisposalTrackId(), true);
	}

	//处理申请详细页面
	public ActionForward detailDisposalTrack(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		DisposalTrack dt = dao.findDisposalTrackById(request.getParameter("did"));
		request.setAttribute("dt", dt);
		return mapping.findForward("detail");
	}
	
	
	/**
	 * 送达回执
	 */
	
	//添加送达回执书
	public ActionForward toReceiptInfoAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		request.setAttribute("cInfo", dao.findById(request.getParameter("cid")));
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addReceiptInfo(ActionMapping mapping, ActionForm form,
		HttpServletRequest request, HttpServletResponse response) {
		ReceiptInfoForm rForm = (ReceiptInfoForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ReceiptInfo info = new ReceiptInfo();
		info.setReceiptInfoBeRecEmp(rForm.getReceiptInfoBeRecEmp());
		info.setReceiptInfoCaseId(rForm.getReceiptInfoCaseId());
		info.setReceiptInfoContractTel(rForm.getReceiptInfoContractTel());
		info.setReceiptInfoDay(rForm.getReceiptInfoDay());
		info.setReceiptInfoFileNum(rForm.getReceiptInfoFileNum());
		info.setReceiptInfoMode(rForm.getReceiptInfoMode());
		info.setReceiptInfoMonth(rForm.getReceiptInfoMonth());
		info.setReceiptInfoNum(rForm.getReceiptInfoNum());
		info.setReceiptInfoPeople(rForm.getReceiptInfoPeople());
		info.setReceiptInfoPlace(rForm.getReceiptInfoPlace());
		info.setReceiptInfoReceiveDay(rForm.getReceiptInfoReceiveDay());
		info.setReceiptInfoReceiveHour(rForm.getReceiptInfoReceiveHour());
		info.setReceiptInfoReceiveMinute(rForm.getReceiptInfoReceiveMinute());
		info.setReceiptInfoReceiveMonth(rForm.getReceiptInfoReceiveMonth());
		info.setReceiptInfoReceiver(rForm.getReceiptInfoReceiver());
		info.setReceiptInfoReceiveYear(rForm.getReceiptInfoReceiveYear());
		info.setReceiptInfoRemark(rForm.getReceiptInfoRemark());
		info.setReceiptInfoSendDay(rForm.getReceiptInfoSendDay());
		info.setReceiptInfoSendHour(rForm.getReceiptInfoSendHour());
		info.setReceiptInfoSendMinute(rForm.getReceiptInfoSendMinute());
		info.setReceiptInfoSendMonth(rForm.getReceiptInfoSendMonth());
		info.setReceiptInfoSendYear(rForm.getReceiptInfoSendYear());
		info.setReceiptInfoYear(rForm.getReceiptInfoYear());
		dao.save(info);
		
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("0");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "ReceiptInfo.add").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/ReceiptInfo.do?method=detailReceiptInfo&rid=" + info.getReceiptInfoId(), true);
	}
	
	//修改送达回执
	public ActionForward toReceiptInfoUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ReceiptInfo info = dao.findReceiptInfoById(request.getParameter("rid"));
		request.setAttribute("rInfo", info);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateReceiptInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ReceiptInfoForm rForm = (ReceiptInfoForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		System.out.println(rForm.getReceiptInfoCaseId());
		ReceiptInfo info = dao.findReceiptInfoById(rForm.getReceiptInfoId());
		info.setReceiptInfoBeRecEmp(rForm.getReceiptInfoBeRecEmp());
		info.setReceiptInfoCaseId(rForm.getReceiptInfoCaseId());
		info.setReceiptInfoContractTel(rForm.getReceiptInfoContractTel());
		info.setReceiptInfoDay(rForm.getReceiptInfoDay());
		info.setReceiptInfoFileNum(rForm.getReceiptInfoFileNum());
		info.setReceiptInfoMode(rForm.getReceiptInfoMode());
		info.setReceiptInfoMonth(rForm.getReceiptInfoMonth());
		info.setReceiptInfoNum(rForm.getReceiptInfoNum());
		info.setReceiptInfoPeople(rForm.getReceiptInfoPeople());
		info.setReceiptInfoPlace(rForm.getReceiptInfoPlace());
		info.setReceiptInfoReceiveDay(rForm.getReceiptInfoReceiveDay());
		info.setReceiptInfoReceiveHour(rForm.getReceiptInfoReceiveHour());
		info.setReceiptInfoReceiveMinute(rForm.getReceiptInfoReceiveMinute());
		info.setReceiptInfoReceiveMonth(rForm.getReceiptInfoReceiveMonth());
		info.setReceiptInfoReceiver(rForm.getReceiptInfoReceiver());
		info.setReceiptInfoReceiveYear(rForm.getReceiptInfoReceiveYear());
		info.setReceiptInfoRemark(rForm.getReceiptInfoRemark());
		info.setReceiptInfoSendDay(rForm.getReceiptInfoSendDay());
		info.setReceiptInfoSendHour(rForm.getReceiptInfoSendHour());
		info.setReceiptInfoSendMinute(rForm.getReceiptInfoSendMinute());
		info.setReceiptInfoSendMonth(rForm.getReceiptInfoSendMonth());
		info.setReceiptInfoSendYear(rForm.getReceiptInfoSendYear());
		info.setReceiptInfoYear(rForm.getReceiptInfoYear());
		
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "ReceiptInfo.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		
		return new ActionForward("/ReceiptInfo.do?method=detailReceiptInfo&rid=" + info.getReceiptInfoId(), true);
	}
	
	//送达回执详细
	public ActionForward detailReceiptInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		ReceiptInfo info = dao.findReceiptInfoById(request.getParameter("rid"));
		request.setAttribute("rInfo", info);
		return mapping.findForward("detail");
	}
	
	//删除送达回执
	public ActionForward deleteReceiptInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ReceiptInfo info = dao.findReceiptInfoById(request.getParameter("rid"));
		String cid = info.getReceiptInfoCaseId();
		dao.delete(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("2");
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "ReceiptInfo.delete").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()));
		logDao.save(s);
		return new ActionForward("/CaseInfo.do?method=detail&cid=" + cid, true);
	}
	
	public ActionForward docReceiptInfo(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		ReceiptInfo info = dao.findReceiptInfoById(request.getParameter("rid"));
		request.setAttribute("rInfo", info);
		return mapping.findForward("doc");
	}
	
	
	
	
	/**
	 *结案申请(审批)模块
	 */
	//结案申请 添加结案申请基本信息 监察员
	public ActionForward toApplyEndcaseAdd(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		return mapping.findForward("toAdd");
	}
	
	public ActionForward addApplyEndcase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ApplyEndcaseForm aForm = (ApplyEndcaseForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ApplyEndcase ae = new ApplyEndcase();
		
		ae.setApplyEndcaseCaseId(aForm.getApplyEndcaseCaseId());
		ae.setApplyEndCaseAbstract(aForm.getApplyEndCaseAbstract());
		ae.setApplyEndCaseMajorId(SystemSession.getSupUserId(request));
		ae.setApplyEndCaseMajorAdvi(aForm.getApplyEndCaseMajorAdvi());
		ae.setApplyEndCaseMajorDate(new Date());
		ae.setApplyEndCaseRemark(aForm.getApplyEndCaseRemark());
		
		//将立案状态修改为结案审批
		CaseInfo info = dao.findById(aForm.getApplyEndcaseCaseId());
		info.setCaseInfoCasestate("5");
		
		dao.save(ae);
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("8");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "addApplyEndcase").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()).replace("$record", info.getCaseInfoCode()));
		logDao.save(s);
		return new ActionForward("/ApplyEndcase.do?method=detailApplyEndcase&aid=" + ae.getApplyEndcaseId(), true);
	}
	
	//修改结案申请 监察员
	public ActionForward toApplyEndcaseUpdate(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ApplyEndcase ae = dao.findApplyEndcaseById(request.getParameter("aid"));
		if(ae.getApplyEndCaseMajorId() != null){
			PersionFile p1 = dao.findPersionFileById(ae.getApplyEndCaseMajorId());
			request.setAttribute("p1", p1);
		}
		request.setAttribute("ae", ae);
		return mapping.findForward("toUpdate");
	}
	
	public ActionForward updateApplyEndcase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ApplyEndcaseForm aForm = (ApplyEndcaseForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ApplyEndcase ae = dao.findApplyEndcaseById(request.getParameter("aid"));
		ae.setApplyEndCaseAbstract(aForm.getApplyEndCaseAbstract());
		ae.setApplyEndCaseMajorAdvi(aForm.getApplyEndCaseMajorAdvi());
		ae.setApplyEndCaseRemark(aForm.getApplyEndCaseRemark());
		dao.merge(ae);
		dao.getSession().flush();
		dao.getSession().clear();
		return new ActionForward("/ApplyEndcase.do?method=detailApplyEndcase&aid=" + ae.getApplyEndcaseId(), true);
	}
	
	//审批结案申请领导
	public ActionForward toApplyEndcaseApply(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ApplyEndcase ae = dao.findApplyEndcaseById(request.getParameter("aid"));
		if(ae.getApplyEndCaseMajorId() != null){
			PersionFile p1 = dao.findPersionFileById(ae.getApplyEndCaseMajorId());
			request.setAttribute("p1", p1);
		}
		request.setAttribute("ae", ae);
		return mapping.findForward("toApply");
	}
	
	public ActionForward applyApplyEndcase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		ApplyEndcaseForm aForm = (ApplyEndcaseForm)form;
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		ApplyEndcase ae = dao.findApplyEndcaseById(request.getParameter("aid"));
		ae.setApplyEndCaseInspeLeadId(SystemSession.getSupUserId(request));
		ae.setApplyEndCaseInspeLeadAdv(aForm.getApplyEndCaseInspeLeadAdv());
		ae.setApplyEndCaseInspeLeadDate(new Date());
		ae.setApplyEndCaseRemark(aForm.getApplyEndCaseRemark());
		CaseInfo info = dao.findById(ae.getApplyEndcaseCaseId());
		info.setCaseInfoCasestate("6");
		info.setCaseInfoEndDate(new Date());
		dao.merge(ae);
		dao.merge(info);
		dao.getSession().flush();
		dao.getSession().clear();
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("9");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "applyApplyEndcase").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()).replace("$record", info.getCaseInfoCode()));
		logDao.save(s);
		return new ActionForward("/ApplyEndcase.do?method=detailApplyEndcase&aid=" + ae.getApplyEndcaseId(), true);
	}
	
	//结案申请详细页面
	public ActionForward detailApplyEndcase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		ApplyEndcase ae = dao.findApplyEndcaseById(request.getParameter("aid"));
		if(ae.getApplyEndCaseMajorId() != null){
			PersionFile p1 = dao.findPersionFileById(ae.getApplyEndCaseMajorId());
			request.setAttribute("p1", p1);
		}
		if(ae.getApplyEndCaseInspeLeadId() != null){
			PersionFile p2 = dao.findPersionFileById(ae.getApplyEndCaseInspeLeadId());
			request.setAttribute("p2", p2);
		}
		request.setAttribute("ae", ae);
		return mapping.findForward("detail");
	}
	
	//结案申请表下载
	public ActionForward docApplyEndcase(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.getSession().flush();
		dao.getSession().clear();
		ApplyEndcase ae = dao.findApplyEndcaseById(request.getParameter("aid"));
		request.setAttribute("cInfo", dao.findById(ae.getApplyEndcaseCaseId()));
		if(ae.getApplyEndCaseMajorId() != null){
			PersionFile p1 = dao.findPersionFileById(ae.getApplyEndCaseMajorId());
			request.setAttribute("p1", p1);
		}
		if(ae.getApplyEndCaseInspeLeadId() != null){
			PersionFile p2 = dao.findPersionFileById(ae.getApplyEndCaseInspeLeadId());
			request.setAttribute("p2", p2);
		}
		request.setAttribute("ae", ae);
		return mapping.findForward("doc");
	}
	//案件转移
	public ActionForward changeInspector(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		PersionFileDAO pDao = new PersionFileDAO(request, response);
		PersionFile persionFile = pDao.findById(request.getParameter("uid"));
		CaseInfo info = dao.findById(request.getParameter("cid"));
	    info.setPersionFile(persionFile);
	    info.setCaseInfoCasestate("e");
		dao.merge(info);
		SysLogInfoDAO logDao = new SysLogInfoDAO(null, null);
		SysLogInfo s = new SysLogInfo();
		s.setPersionFile(SystemSession.getSupUserInfo(request));
		s.setSysLogInfoOperDate(new Date());
		s.setSysLogInfoOperType("1");
		s.setSysLogInfoSupOrganCode(SystemSession.getSupUserInfo(request).getPerFileOrganCode());
		s.setSysLogInfoOperRecord(SystemConfig.getString("syslog", "ChangeInspector.update").replace("$user", SystemSession.getSupUserInfo(request).getPerFileName()).replace("$record", info.getCaseInfoCode()));
		logDao.save(s);
		dao.getSession().flush();
		dao.getSession().clear();
		return mapping.findForward("changeSuccess");
	}
	
	public ActionForward allToDied(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		CaseInfoDAO dao = new CaseInfoDAO(request, response);
		dao.goto_died();
		return mapping.findForward("null");
	}
}